In my windows installation PATH
includes C:\\Program Files\\nodejs
, where executable node.exe
is. I\'m able to launch node
Delete node folder completely from program file folder. Uninstall node.js and then reinstall it. change Path of environment variable PATH. delete .npmrc file from C:\users\yourusername
The default global folder is C:\Users\{username}\AppData\Roaming\npm
.
You can create (if it doesn't exist) a .npmrc
file in C:\Users\{username}\
and add
prefix = "path\\to\\yourglobalfolder"
.
Note that, in windows, the path should be separated by double back-slash
.
it does not require much configurations just go to advanced system settings copy the path where you have installed your node and just create an environment variable and check with node -v command in your prompt!
In Windows, if you want to move the npm or nodejs folder in disk C to another location, but it still makes sure node and npm works well, you can create symlink like this: Open Command Prompt:
mklink /D "your_location_want_to_create_symlink" "location_of_node_npm_file"
Example:
mklink /D "C:\Users\MyUser\AppData\Roaming\npm" "D:\Nodejs Data\npm"
Now you've created a symlink for npm folder, this symlink will refer to D:\Nodejs Data\npm
Everything will work well.
trying to install global packages into C:\Program Files (x86)\nodejs\
gave me Run as Administrator issues, because npm was trying to install into
C:\Program Files (x86)\nodejs\node_modules\
to resolve this, change global install directory to C:\Users\{username}\AppData\Roaming\npm
:
in C:\Users\{username}\
, create .npmrc
file with contents:
prefix = "C:\\Users\\{username}\\AppData\\Roaming\\npm"
reference
npm install -g package
installs global packages into prefix locationnpm config ls -l
was showing prefix = "C:\\Program Files (x86)\\nodejs"
environment
nodejs x86 installer into C:\Program Files (x86)\nodejs\
on Windows 7 Ultimate N 64-bit SP1
node --version
: v0.10.28
npm --version
: 1.4.10
You can see my answer to this in my answer to another question.
In Windows, the global install path is actually in your user's profile directory
%USERPROFILE%\AppData\Roaming\npm
%USERPROFILE%\AppData\Roaming\npm-cache
npm install
as that user. Some modules/utilities should be installed globally....\npm
directory to your users path yourself.To change the "global" location for all users to a more appropriate shared global location %ALLUSERSPROFILE%\(npm|npm-cache)
(do this as an administrator):
[NODE_INSTALL_PATH]\etc\
directory
npm config --global ...
actionsC:\ProgramData\npm-cache
- npm modules will go hereC:\ProgramData\npm
- binary scripts for globally installed modules will go hereC:\ProgramData\npm\node_modules
- globally installed modules will go herenpm config --global set prefix "C:\ProgramData\npm"
npm config --global set cache "C:\ProgramData\npm-cache"
C:\ProgramData\npm
to your System's Path environment variable If you want to change your user's "global" location to %LOCALAPPDATA%\(npm|npm-cache)
path instead:
C:\Users\YOURNAME\AppData\Local\npm-cache
- npm modules will go hereC:\Users\YOURNAME\AppData\Local\npm
- binary scripts for installed modules will go hereC:\Users\YOURNAME\AppData\Local\npm\node_modules
- globally installed modules will go herenpm config set prefix "C:\Users\YOURNAME\AppData\Local\npm"
npm config set cache "C:\Users\YOURNAME\AppData\Local\npm-cache"
PATH
.
setx PATH "%PATH%;C:\Users\YOURNAME\AppData\Local\npm"