nodejs one-to-one npm multi-version installation

nodejs one-to-one npm multi-version installation

Table of contents

nodejs one-to-one npm multi-version installation

1. win7 installs the new high version of nodejs by default

2. npm checks its own list of supported download versions:

3. Select the highest version 8.19.3 of version 8 under Win7 to install npm globally:

4. Win7 replaces the version of npm:

5. Win7 replaces the npm version and adapts it to the installed nodejs version:

5.1. Change the default cache and prefix of npm

5.1.1. By default, the npm cache path is always at the same level as the nodejs installation path:

 5.1.2. Delete the cache path of npm

 5.1.3. Redirect the cache path of npm and its pre-path when called by node

5.2. Replace with the npm version you want to install

6. Easily install various "packages"


        Take the win7 environment as an example (the same method as win10), other OS platforms are similar.

1. win7 installs the new high version of nodejs by default

        13.14.0. Official download:



Index of /download/release/v13.14.0/

Previous Releases | Node.js

Installing Node.js via package manager | Node.js

2. npm checks its own list of supported download versions:

npm view npm versions

3. Select the highest version 8.19.3 of version 8 under Win7 to install npm globally:

npm install -g [email protected]

4. Win7 replaces the version of npm:

        The first thing to do is to remove npm
 

npm uninstall -g npm
npm uninstall npm

5. Win7 replaces the npm version and adapts it to the installed nodejs version:

5.1. Change the default cache and prefix of npm

5.1.1. By default, the npm cache path is always at the same level as the nodejs installation path:

 C:\Users\Administrator\AppData\Local\npm-cache

If manual configuration exists:

        When npm is called by node, the default pre-path is:

 prefix=${APPDATA}\npm

Right now:

C:\Users\Administrator\AppData\Roaming\npm

 

 5.1.2. Delete the cache path of npm

The path of npm under C:\Users\Administrator\AppData

C:\Users\Administrator\AppData\Roaming path

If you have manual installation, for example:

C:\Program Files\npm_cache, you can also delete it

 5.1.3. Redirect the cache path of npm and its pre-path when called by node

        After backup, modify them:

Change the path to the version of "currently installed nodejs", the same path:

prefix = C:\Program Files\nodejs\node_global
cache = C:\Program Files\nodejs\node_global

5.2. Replace with the npm version you want to install

After restarting the computer:

        According to the npm version in "2. npm checks its own list of supported download versions", select the appropriate version (such as 8.0.0) for global installation:

npm install -g [email protected]

       Such as 5.1.3, change the path to the version of "currently installed nodejs", after the same path, the installation result:

 

6. Easily install various "packages"

 

If you like it, please collect it and give it a thumbs up to encourage me to continue to write original technology:

Common factors and solutions affecting WebPack deployment - Pulledup Blog - CSDN Blog 

Deploying vue element-ui admin error (vue2)_pulledup's Blog-CSDN Blog

Cross-domain deployment of process.env.NODE_ENV and @vue/cli-service and its .env.* default external environment configuration files_pulledup's Blog-CSDN Blog

Linux deploys node.JS, NginX, egg, MongoDB and CentOS for back-end services in the non-js world-Tencent Cloud_pulledup's Blog-CSDN Blog_nginx eggjs

Guess you like

Origin blog.csdn.net/pulledup/article/details/127829786
Recommended