I'm trying to use node.js, npm with grunt. I downloaded node.js with npm, ran npm install from project directory. It ran fine. Then I ran install npm -g grunt-cli, which ended with 'Ok'.
I'm running all these with default install and behind proxy which I properly configured.
Now on trying to run grunt from project directory results in following error:
module.js:340
throw err;
^
Error: Cannot find module '%APPDATA%\npm\Roaming\npm\node_modules\grunt-cli'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
Notice, it inserts Roaming\npm again in search path. Is there a config setting somewhere where it gets this path? What is causing it to append Roaming\npm to prefix path?
npm config get prefix : %APPDATA%\npm
NODE_PATH environment variable is set to %APPDATA%\npm
I also tried npm cache clean
Edit: I changed %APPDATA%\grunt.cmd file. Now it gets correct path, but error still persists. It says %APPDATA%\node_modules\grunt-cli can't be found, but it is there.
This was due to a bug in path module. Please see here: grunt issue