isaacs/npm — Issue #1660: Windows install instructions are incomplete when node.js was installed via chocolatey
Author: joewhite
Created: 2011-11-05 14:27:35+00:00
State: open

I installed nodejs via chocolatey, and then followed the instructions in npm's README to install npm. When I was done, the npm files were there, but typing `npm` at a command prompt gave me a `'npm' is not recognized as an internal or external command, operable program or batch file` error -- even though I am successfully able to run `node` from the command line.

It looks like the problem is the strange way that Chocolatey set up directories and updated the PATH when it installed node. npm's README assumes that, if `node` is on the path, then it can drop `npm.cmd` into the same directory as `node.exe` and everything will work (seems reasonable enough!). But chocolatey installed node.exe into C:\NuGet\lib\nodejs.0.5.9\tools, and didn't add that directory to the PATH. Instead, it added C:\NuGet\bin to the PATH, and in that directory is a node.bat containing the following batch script:

@echo off
"C:\NuGet\lib\nodejs.0.5.9\tools\node.exe" %*

I was able to get npm to work by making an npm.bat in the same directory, that does the same thing but references `npm.cmd` instead of `node.exe`.

Until there's a chocolatey package for npm that does this automatically, it would be nice if the README included this detail. Chocolatey is a "recommended" way to install node on Windows, so this issue will probably come up again.