grunt icon indicating copy to clipboard operation
grunt copied to clipboard

Error with findup-sync. Object Gruntfile.js has no method 'flatten'

Open programmerdave opened this issue 13 years ago • 12 comments

Hi, I'm on Ubuntu 12.04LTS and trying to use grunt but I get this error when I try to run any grunt tasks. Any ideas?

Running node v0.10.17, grunt-cli v0.1.9, grunt v0.4.1

/workspace/Web Client/node_modules/grunt/node_modules/findup-sync/lib/findup-sync.js:33
    }).flatten().uniq().value();
       ^
TypeError: Object Gruntfile.js has no method 'flatten'
    at Object.module.exports [as findup] (/workspace/Web Client/node_modules/grunt/node_modules/findup-sync/lib/findup-sync.js:33:8)
    at Task.task.init (/workspace/Web Client/node_modules/grunt/lib/grunt/task.js:414:16)
    at Object.grunt.tasks (/workspace/Web Client/node_modules/grunt/lib/grunt.js:113:8)
    at Object.module.exports [as cli] (/workspace/Web Client/node_modules/grunt/lib/grunt/cli.js:38:9)
    at Object.<anonymous> (/usr/lib/node_modules/grunt-cli/bin/grunt:41:20)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

programmerdave avatar Sep 06 '13 03:09 programmerdave

Hey @programmerdave, thanks for filing an issue! Sadly I can't reproduce your issue with node 0.10.18, could you paste your Gruntfile maybe?
Object Gruntfile.js has no method 'flatten' looks really strange.

vladikoff avatar Sep 06 '13 04:09 vladikoff

It sounds like lodash failed to install. I would try npm cache clean and reinstalling everything.

shama avatar Sep 06 '13 04:09 shama

Awesome! I found that it was a bad installation of the modules. I was committing my node_modules folder to git. Then Jenkins was pulling that down and running npm rebuild, grunt build. And what happened was that I was ignoring the dist folder in my .gitignore file so that meant ALL the dist folders where ignored haha my bad. I changed that to /dist on my root directory and then all the dist folders in node_modules where successfully uploaded and now it builds!

Thanks guys

programmerdave avatar Sep 11 '13 17:09 programmerdave

@programmerdave Thanks! I hit the exact same issue. Didn't take out dist from .gitignore.

dtryon avatar Oct 16 '13 13:10 dtryon

I bumped into this by accidentally working on my project in node 0.10, then trying to run grunt back in 0.8. Deleting nodule_modules/grunt and running npm install from 0.8 fixed it up.

halfninja avatar Oct 21 '13 14:10 halfninja

I had dist/ in all my .gitignore files. Removing it fixed my builds. Thanks @programmerdave!

sankargorthi avatar Nov 05 '13 19:11 sankargorthi

I did not have dist in my local .gitignore and could not figure this out! I finally found my ~/.gitignore file which had dist in it. That file was a stupid idea. I removed the crap out of it.

kumar303 avatar Mar 07 '14 17:03 kumar303

Hey guys, same problem here. I tried npm cache clean and removing dits from .gitingnore but having the same issue. I'm using this versions

  • node v0.10.26
  • npm 1.4.3
  • grunt-cli v0.1.13
  • grunt v0.4.4

And a very curious thing that is happening to me is that if I run npm install I got the dependencies downloaded in the node_modules fldr as usual without any error, but If I run the command again I get all the dependencies downloaded again, which is not normal in npm

farolfo avatar Apr 16 '14 16:04 farolfo

ok, fixed. It seems that deleting the node_modules folder besides the npm clean cache solved it ;)

farolfo avatar Apr 16 '14 17:04 farolfo

alias nomnom="rm -rf node_modules && npm cache clean && npm i"

shama avatar Apr 16 '14 17:04 shama

I faced a similar error and installed modules error log complained of not found. Then removed node_modules an cleaned the cache as stated above. Now fixed, thanks to all

ilhnctn avatar Jan 08 '15 09:01 ilhnctn

Had the same error today. This is how I solved it:

  1. npm cache clean
  2. rm -rf node_modules
  3. Read http://stackoverflow.com/questions/15444020/cannot-find-module-findup-sync-when-trying-to-run-grunt

umairsarwar avatar Mar 06 '17 15:03 umairsarwar