To install Node.js and npm, you first need to install curl
sudo apt install curl
Then use this command to add the required repository to your system.
The command will also update the package database afterwards
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
Use this command to install Node.js and npm
sudo apt install nodejs
Finally, verify that Node.js is installed
node —version
> v6.15.1
You may also use this command to provide more details about the installed packages
npm version
{ npm: ‘3.10.10’,
ares: ‘1.10.1-DEV’,
http_parser: ‘2.8.0’,
icu: ‘58.2’,
modules: ’48’,
napi: ‘3’,
node: ‘6.15.1’,
openssl: ‘1.0.2q’,
uv: ‘1.16.1’,
v8: ‘5.1.281.111’,
zlib: ‘1.2.11’ }
Leave a comment