3

I am having an issue with the path that my node packages are installing on Windows 8.1. Having installed node using Chocolatey I done the following steps:

Install Chocolatey
choco install npm
npm install -g grunt-cli

So having done the above I open a cmd prompt in admin mode and type 'npm', it works fine from any directory an gives me the usual npm usage stuff. Next I type 'grunt' and I get ''grunt' is not recognized as an internal or external command...'.

So straight away I think this is a PATH problem which it most likely is.

My PATH had nothing to do with npm on it, so I added 'C:\Users\MYNAME\AppData\Roaming\npm' to it, tried 'grunt' again with no luck. I looked inside 'C:\Users\MYNAME\AppData\Roaming\npm\node_modules' and nothing is installed so I ran 'npm install -g grunt-cli' again and noticed

C:\ProgramData\chocolatey\lib\nodejs.commandline.0.10.33\tools\grunt -> C:\ProgramData\chocolatey\lib\nodejs.commandline
.0.10.33\tools\node_modules\grunt-cli\bin\grunt
grunt-cli@0.1.13 C:\ProgramData\chocolatey\lib\nodejs.commandline.0.10.33\tools\node_modules\grunt-cli
├── resolve@0.3.1
├── nopt@1.0.10 (abbrev@1.0.5)
└── findup-sync@0.1.3 (lodash@2.4.1, glob@3.2.11)

So from looking at this npm is installing everything in 'C:\ProgramData\chocolatey\lib\nodejs.commandline.0.10.33\tools\node_modules' my question is should I just add this to my path and work ahead or is there something I can do to get npm to use the default install location in 'C:\Users\MYNAME\AppData\Roaming\npm' as the npm-cache in 'C:\Users\MYNAME\AppData\Roaming\npm-cache' seems to filling up as expected?

Thanks

cjfarrelly
  • 201
  • 2
  • 9

2 Answers2

3

NPM might be tool old from that package. It's my understanding they are no longer offering a separate NPM away from NodeJS (I could be incorrect here, I'd love to be wrong).

I'd prefer using the nodejs.install package (which comes with npm).

To answer your question: the location with a package version is not optimal, but I'm not sure that NPM knows a better location as of the version that is out. I don't have a good answer for you on getting NPM to look at the correct install location based on using the NPM package (which is 1.4.9). https://en.wikipedia.org/wiki/Npm_(software)

ferventcoder
  • 11,952
  • 3
  • 57
  • 90
3

Thanks for the reply, your exactly right from my understanding. It's a problem with installing npm via chocolatey which is what I was thinking also but you clarified it.

The fix was to delete the chocolatey node_modules folders and npm from chocolatey, tidy up my PATH and then install node.js from the node.js website and npm comes packaged with that, it updated my PATH and everything now works as expected.

Thanks again!

cjfarrelly
  • 201
  • 2
  • 9