With multi-dimensional model as the core, let the factory digital transformation and upgrading “within reach”>>>
Nodejs download address (official website)
https://nodejs.org/en/download/
After downloading, it is a tar, XZ compressed package
Upload the compressed package to the Linux server through xftp
If I put it in the root directory
Using xshell to connect to remote server
CD to the current directory (the default is the root directory)
Execute the following command to unzip
Tar xvjf node-v10.16.3-linux-x64.tar.xz or tar XF node-v10.16.3-linux-x64.tar.xz
The difference is that xvjf can see the decompression, but XF can’t
xvJf
xf
Establishing a soft connection
Configure node
ln -s /root/node-v10.16.3-linux-x64/bin/node /usr/local/bin/node
Configure NPM
ln -s /root/node-v10.16.3-linux-x64/bin/npm /usr/local/bin/npm
PS: pay attention
/Root/node-v10.16.3-linux-x64/is the installation path of node
The last English of the soft connection should correspond to the English after bin (note that there is a space in the middle, such as/node/USR)
If the following error occurs when executing the command, such as NPM install Vue
Error: Cannot find module ‘/root/node-v10.16.3-linux-x64/install’
Then it’s possible that you made a mistake when setting up the soft connection
PS: pay attention
If a soft connection is established (the last English of the soft connection should follow bin, for example: ln – S/root/node-v10.16.3-linux-x64/bin/node/usr/local/bin/NPM)
Congratulations (when you execute node – V or NPM – V, you will report an error when you execute NPM install Vue)
At this time, you may be re executing the soft connection(
ln: failed to create symbolic link ‘/usr/local/bin/npm’: File exists)
The reason is already related in your/usr/local/bin/NPM
terms of settlement:
ln -sf /root/node-v10.16.3-linux-x64/bin/npm /usr/local/bin/npm
The references are as follows:
https://askubuntu.com/questions/379647/failed-to-create-symbolic-link-usr-bin-utserver-file-exists
OK, solve it
To configure Taobao image
npm install -g cnpm –registry= https://registry.npm.taobao.org
Configure soft connection
ln -s /root/node-v10.16.3-linux-x64/bin/cnpm /usr/local/bin/cnpm