How do I install the latest version of node.js?
Solution 1:
Per the Node.js website:
# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Then, you will have the latest version of Node.js.
If you're not a fan of curl <url> | bash -
, or are using an unsupported distribution, you can try a manual installation.
Solution 2:
Node is one of the easier projects to build. Just change the version as that continues to change.
Browse to http://nodejs.org/dist/latest/ to find out the latest package version.
cd /usr/local/src
wget http://nodejs.org/dist/latest/node-v7.2.1.tar.gz
tar -xvzf node-v7.2.1.tar.gz
cd node-v7.2.1
./configure
make
sudo make install
which node
You should see /usr/local/bin/node
.