Home > Article > Operation and Maintenance > How to quickly uninstall and install the node environment in linux
sudo npm uninstall npm -g
yum remove nodejs npm -y
See if there are any residues
Enter /usr/local/lib Delete all node and node_modules folders
Enter /usr/local/include Delete all node and node_modules folders
Enter /usr/local/bin Delete the node executable file
Download:
wget https://cdn.npm.taobao.org/dist/node/v12.13.1/node-v12.13.1-linux-x64.tar.xz
Unzip:
xz -d node-v12.13.1-linux-x64.tar.xz tar -xvf node-v12.13.1-linux-x64.tar
Move to local directory:
mv node-v12.13.1-linux-x64 /usr/local/
Rename:
mv /usr/local/node-v12.13.1-linux-x64/ /usr/local/node
Add environment configuration:
vim /etc/profile
Add content at the end of the file:
export NODE_HOME=/usr/local/node export PATH=$NODE_HOME/bin:$PATH
Execute source to make the environment variables effective immediately.
source /etc/profile
Check the version and complete the installation as follows.
node -v
can output version information, that is, ok
npm -v
can output version information, that is, ok
The above is the detailed content of How to quickly uninstall and install the node environment in linux. For more information, please follow other related articles on the PHP Chinese website!