Node.js is available from the NodeSource Debian and Ubuntu binary distributions repository (formerly Chris Lea’sLaunchpad PPA). Support for this repository, along with its scripts, can be found on GitHub at nodesource/distributions.
NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about running Node.js >= 6.x on older distros.
1 2 |
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt-get install -y nodejs |
Alternatively, for Node.js 8:
1 2 |
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs |
Optional: install build tools
To compile and install native addons from npm you may also need to install build tools:
1 |
sudo apt-get install -y build-essential |