Home  >  Article  >  Operation and Maintenance  >  How to install linux node and cnpm

How to install linux node and cnpm

WBOY
WBOYforward
2023-05-23 12:43:061967browse

Installation method of linux node cnpm: 1. Download the linux version of node and place it in the "/home/node/" directory; 2. Open linux Unzip gz; 3. Return to the root directory and establish a soft connection; 4. Install cnpm through "npm install -g cnpm --registry=https://registry.npm.taobao.org".

linux Detailed graphic and text explanation of installing node, npm and cnpm

You must install node and npm before installing cnpm!

1. Download the linux version of node

Download | Node.js Chinese website

linux node和cnpm如何安装

linux node和cnpm如何安装

2. Put it in the /home/node/ directory

3. Open linux and decompress gz. Here, the xz suffix and the gz suffix are both compressed packages, but the decompression commands are different. I downloaded gz here. Suffix

cd /home/node/
tar -zxvf node-v14.15.5-linux-x64.tar.gz

linux node和cnpm如何安装

4. Return to the root directory. It is very important to note that ln -s cannot be a relative path.

cd /

5. To create Soft link, please note ln -s that l is the lower case of L and the l is not the upper case I of i. Attention!

ln -s /home/node/node-v14.15.5-linux-x64/bin/node /usr/local/bin/node
ln -s /home/node/node-v14.15.5-linux-x64/bin/npm /usr/local/bin/npm

linux node和cnpm如何安装

6. Check whether node and npm are successful.

node -v
npm -v

linux node和cnpm如何安装

7. Install cnpm

cd /
npm install -g cnpm --registry=https://registry.npm.taobao.org

linux node和cnpm如何安装

Open ftp and look at the /home/node/node-v14.15.5-linux-x64/bin/ directory. There is already cnpm underneath it

linux node和cnpm如何安装

8. Establish a soft connection

ln -s /home/node/node-v14.15.5-linux-x64/bin/cnpm /usr/local/bin/cnpm
cnpm -v

linux node和cnpm如何安装

9. The installation is complete.

The above is the detailed content of How to install linux node and cnpm. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete