Modify global NPM default installation path [turn]

Scenes:

After the recently completed environmental tinker on a new computer, going to the next source switching, the results suggested that no command nrm global-installed, so before are now how to die with it?

 

The investigation process:

So all kinds of struggles, found - g installed plug-ins in a directory path to the C disk, and later re-think yourself a node installed, change the installation directory, but when you reinstall - dependent directory g command does not install change.

Because I reinstalled nodejs, so after I installed with yarn, can not be installed to the local npm specified, although the yarn path config get prefix obtained and npm config get prefix is ​​the same, but the installation was also installed to nodejs / the bin file, in nodejs / node_modules not

 

solution:

  1. In D: \ nodejs (I installed the D drive, please operation in conjunction with each case) file, create a new folder node_cache, then open cmd, npm config set cache "D: \ nodejs \ node_cache"
  2. Continue to run in cmd npm config set prefix "D: \ nodejs", there already has node_modules folder, and when the global installed, it will automatically find the folder, so that we need to manually create a new folder
  3. Modify D: \ nodejs \ node_modules \ npm \ npmrc file prefix = D: \ nodejs. This time, after the global installation, use, in order to truly find from where we set up, it does not appear the case of the installation, can not use the

Scenes:

After the recently completed environmental tinker on a new computer, going to the next source switching, the results suggested that no command nrm global-installed, so before are now how to die with it?

 

The investigation process:

So all kinds of struggles, found - g installed plug-ins in a directory path to the C disk, and later re-think yourself a node installed, change the installation directory, but when you reinstall - dependent directory g command does not install change.

Because I reinstalled nodejs, so after I installed with yarn, can not be installed to the local npm specified, although the yarn path config get prefix obtained and npm config get prefix is ​​the same, but the installation was also installed to nodejs / the bin file, in nodejs / node_modules not

 

solution:

  1. In D: \ nodejs (I installed the D drive, please operation in conjunction with each case) file, create a new folder node_cache, then open cmd, npm config set cache "D: \ nodejs \ node_cache"
  2. Continue to run in cmd npm config set prefix "D: \ nodejs", there already has node_modules folder, and when the global installed, it will automatically find the folder, so that we need to manually create a new folder
  3. Modify D: \ nodejs \ node_modules \ npm \ npmrc file prefix = D: \ nodejs. This time, after the global installation, use, in order to truly find from where we set up, it does not appear the case of the installation, can not use the

Guess you like

Origin www.cnblogs.com/mazhenyu/p/12120688.html
Recommended