![]() Once you copy this path set this to the environment variables, with a variable name Path(anything you can select as a name). This is a path image which you need to select In Roaming folder of your C drive you will find npm and npm-cache folder.Ĭlick on the + npm + folder and select the path. Now visit the following path to see npm and npm-cache folder.Ĭ:\Users\username(OR Number)\AppData\Roaming It will return you the current path where node modules are installing right now. To Change the default global installation directory for node.js(npm) modules in Windows, You need to fix 2 paths.įirst check the current path where node modules are installing, when you try to install them globally by using following command : Each user can then run node and npm as required. Performing the above steps helped us running nodejs as system wide installation, easily available to all users with proper permissions. It is important the steps above are carried out preferably in sequence and before updating npm ( npm -g install or attempting to install any npm module. Npm config -global set cache "C:\ProgramData\nodejs\npm-cache" Npm config -global set prefix "C:\ProgramData\nodejs" Set NODE_PATH environment variable as C:\ProgramData\nodejs\node_modules.Įnsure %NODE% environment variable previously created above is added (or its path) is added to %PATH% environment variable.Įdit %NODE_PATH%\npm\npmrc with the following content prefix=C:\ProgramData\nodejsįrom command prompt, set the global config like so. Set NODE environment variable as C:\ProgramData\nodejs. Then create a folder called npm-cache at the root of the installation directory, which after following above would be C:\ProgramData\nodejs\npm-cache.Ĭreate a folder called etc at the root of the installation directory, which after following above would be C:\ProgramData\nodejs\etc. This can be done with chocolatey as: choco install nodejs.install -ia "'INSTALLDIR=C:\ProgramData\nodejs'" setx PATH "%PATH% C:\Users\YOURNAME\AppData\Local\npm"īuilding on the installation concept of chocolatey and the idea suggested by what worked for me was to do the following and all users on windows were then happy working with nodejs and npm.Ĭhoose C:\ProgramData\nodejs as installation directory for nodejs and install nodejs with any user that is a member of the administrator group.Add the new npm path to your environment's PATH.npm config set cache "C:\Users\YOURNAME\AppData\Local\npm-cache".npm config set prefix "C:\Users\YOURNAME\AppData\Local\npm".C:\Users\YOURNAME\AppData\Local\npm\node_modules - globally installed modules will go here.C:\Users\YOURNAME\AppData\Local\npm - binary scripts for installed modules will go here.C:\Users\YOURNAME\AppData\Local\npm-cache - npm modules will go here.If you want to change your user's "global" location to %LOCALAPPDATA%\(npm|npm-cache) path instead: Add C:\ProgramData\npm to your System's Path environment variable.npm config -global set cache "C:\ProgramData\npm-cache".npm config -global set prefix "C:\ProgramData\npm".Set global configuration settings (Administrator Command Prompt).C:\ProgramData\npm\node_modules - globally installed modules will go here. ![]() C:\ProgramData\npm - binary scripts for globally installed modules will go here.C:\ProgramData\npm-cache - npm modules will go here.create the global (admin) location(s) for npm modules.this is needed before you try npm config -global.To change the "global" location for all users to a more appropriate shared global location %ALLUSERSPROFILE%\(npm|npm-cache) (do this as an administrator): ![]() \npm directory to your users path yourself.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |