Configuration node under centOS7 bad environment

1, create a folder to place node installation package in the root, and enter

mkdir local
cd local
mkdir node
cd node

2, by pulling the node xShell xz installation package
Note: the installation package address https://npm.taobao.org/mirrors/node
Here Insert Picture Description
. 3, node extracting installation package
Note: corresponding to their own node version

xz -d node-v8.12.0-linux-x64.tar.xz 
tar -xvf node-v8.12.0-linux-x64.tar

4, delete node installation package

rm -rf node-v8.12.0-linux-x64.tar

5, rename node

mv node-v.8.12.0-linux-x64.tar node-v.8.12.0

6, see your PATH variable

echo $PATH

Here Insert Picture Description
Because for the first time on the server, nothing, so following a good set PATH create corresponding folders, here I chose the Create / root / bin folder, which is the last PATH

7, and then you create soft link

ln -s /usr/local/node/node-v8.12.0/bin/npm /root/bin/npm

ln -s /usr/local/node/node-v8.12.0/bin/node /root/bin/node

8, to test whether the installation is successful

node -v
npm -v

Here Insert Picture Description

Released three original articles · won praise 3 · views 44

Guess you like

Origin blog.csdn.net/weixin_43848532/article/details/104999032