Node.js, a free and open source cross-platform JavaScript runtime environment, can be used to develop Web applications and Web tools based on Google’s V8 JavaScript engine. Node.js allows you to run scripts on the server side, and use JavaScript to create dynamic Web content that is then sent to the user’s Web browser. The ability to implement asynchronous I/O makes Node.js fast and extensible.
Install node. js on Ubuntu 18.04 LTS
First, upgrade source and installation package
apt-get update -y
apt-get install -y build-essential curl
Copy the code
Second, pre-install PPA node.js source
A – Node.js v8.x – LTS:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
Copy the code
B – Node.js v10.x:
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
Copy the code
Third, install Node.js
apt-get install -y nodejs
Copy the code
Fourth, detect the installation situation
1. Check node.js
nodejs -v
Copy the code
2. Detect NPM
npm -v
Copy the code
complete
Ubuntu16.04 Node and NPM are uninstalled
# apt - get unloaded
sudo apt-get remove --purge npm
sudo apt-get remove --purge nodejs
sudo apt-get remove --purge nodejs-legacy
sudo apt-get autoremove
# Delete NPM directory manually
rm -r /usr/local/bin/npm
rm -r /usr/local/lib/node-moudels
find / -name npm
rm -r /tmp/npm*
Copy the code