npm

Xz or tar -xvjf node-v12.13.1-linux-x64.tar.xzCopy the code
  • Switch to the decompressed nodejs directory
  • The soft connection is set up and becomes global
ln -s /usr/local/ node - v12.13.1 - Linux - x64 / bin/NPM/usr /local/bin/npm
ln -s /usr/local/ node - v12.13.1 - Linux - x64 / bin/node/usr /local/bin/node
Copy the code

  • View the installed version

cnpm

Because all the downloads are from foreign servers, it is very slow and will drop off, so we need to use the NPM image of Taobao, CNPM. Taobao team did the domestic mirror, because the NPM server is located abroad may affect the installation. Taobao mirror and the official synchronization frequency is now 10 minutes to ensure as much as possible with the official service synchronization.

npm install -g cnpm --registry="https://registry.npm.taobao.org"
Copy the code



As you can see, CNPM will be installed in bin, and the system variable does not contain this path.





As above, add global variables to CNPM

ln -s /usr/local/ node - v12.13.1 - Linux - x64 / bin/CNPM/usr /local/bin/cnpm
Copy the code

View version information after completion:



Support all NPM commands except publish, such as: