1

I am new to Grunt. I have my grunt (verified version and such) and I see my needed Npmtasks in my "node_modules" folder. But, when I try to run the grunt, it fails because the task module can't be found.

grunt default -v

I have my node_modules installed in my drive:

C:\Users\NoBody\node_modules

Usually, this isn't an issue. BUT, it appear that where I am doing my dev:

C:\users\Nobody\Desktop\Development\GruntExamples\

can't locate my needed NpmTask modules. When I move the files into: C:\Users\Nobody -- everything works.. But, I don't want to do my dev there.

I tried adding the path to NpmTaks like so:

grunt.loadNpmTasks("../../../../grunt-contrib-clean");

I tried a few other "paths", nothing is working. Is there a "path" declaration I can add to my grunt file that will let my task resolve where it needs to?

note: I tried npm install grunt-contrib-clean --save-dev (no luck), I tried grunt-contrib-clean -g (no luck)..

But just like I mentioned. If I move my files inside the same root dir that my node_modules sit, it works... but again, I don't want to do my dev here.

Please advise.

james emanon
  • 11,185
  • 11
  • 56
  • 97

1 Answers1

1

Using symbolic links seems to be an option (How to make Grunt Deploy use global NPM modules instead of local ones), although I have never tried it.

However, I would advise against using a global node_modules location. My reasoning:

  • Local copies of your dependencies do not affect each other. Updating karma, for instance, in one of your code bases does not affect the others. Trying out a new version of grunt will not harm anybody else.
  • Some people say that you also should ship your node_modules folder (link) - a thing that you can only do if you have a local copy
Community
  • 1
  • 1
meilke
  • 3,280
  • 1
  • 15
  • 31
  • hmm, perhaps because I am new to grunt -- but it is normal protocal to have all your node_modules in the local dir, and then bundle it all up? I was just thinking that that is a lot of duplication of required npm's. – james emanon Feb 16 '15 at 20:48
  • 1
    Enormous duplication, lots of space used up etc. But tackling the ages-old dependency problem in a very robust way. – meilke Feb 16 '15 at 20:50