npm install -g npm
(updating npm to v1.4.20)npm -v
: v1.4.14 (located in c:\Program Files\nodejs\node_modules\npm
)c:\Users\User\AppData\Roaming\npm\node_modules\npm
echo %path
:
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs;C:\Ruby200-x64\bin;C:\python27
sh.exe": npm: command not found
%AppData%\npm\node_modules
doesn't fix it
6. Adding NODE_PATH
to system wide environment variables with %AppData\npm\node_modules
is not helping
The problem is essentially that it refuses to recognize the global npm installation in %AppData%\npm\node_modules
even when I remove C:\Program Files\nodejs
from the path and replace it with %AppData%\npm\node_modules
.
What am I doing wrong? How do I fix this?
After opening this issue on joyent/node, this reply suggests using the Node.js command prompt as a temporary workaround.
Preparation:
C:\Program Files\nodejs
from any environment variablesNODE_PATH
with this value: %AppData%\npm\node_modules
Check your .npmrc
file (Windows: C:\Users\[User]\.npmrc
)
If the value for prefix
is c:\Program Files\nodejs
, add prefix = c:\Users\[User]\AppData\Roaming\npm
to the user config area (at the top of the file)
After this:
npm -v
: 1.4.14npm install -g npm
npm -v
: 1.4.21First of all, a safe and error free node.js on windows, can be achieved if you install it in "C:\nodejs\"
instead of installing it in ProgramFiles
or any other directory because of some read/write permissions.
For the question...
go to cmd and run
npm install -g npm
and copy "npm" folder from
C:\Users\\AppData\Roaming\npm\node_modules\npm\node_modules
//first npm is the installed version and then npm modules are its
// modules installed one of them is your new npm that is the result
// of above command. we are copying it to its insaller. the father :P
Paste this copied "npm" folder into this path and overwrite if it asks
C:\Program Files\nodejs\node_modules
check your verison it will be latest. by
npm -v //in cmd
If using Windows 7 or later, try:
move "C:\Program Files\nodejs\node_modules\npm" "C:\Program Files\nodejs\node_modules\npm.bak"
mklink /D "C:\Program Files\nodejs\node_modules\npm" "%AppData%\npm\node_modules\npm"
Check your path environment variable. My guess is that it lists both the program files and the appdata directories, and the program files location is listed first. The first one found on the path is the one that will run.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With