Install Node.js on Ubuntu/Debian
To install Node.js on Ubuntu, first set up repository as per your version requirements.
For NodeJs v21.x
1 |
curl -sL https://deb.nodesource.com/setup_21.x | bash - |
For NodeJs v20.x
1 |
curl -sL https://deb.nodesource.com/setup_20.x | bash - |
For NodeJs v18.x
1 |
curl -sL https://deb.nodesource.com/setup_18.x | bash - |
For NodeJs v17.x
1 |
curl -sL https://deb.nodesource.com/setup_17.x | bash - |
For NodeJs v16.x
1 |
curl -sL https://deb.nodesource.com/setup_16.x | bash - |
For NodeJs v15.x
1 |
curl -sL https://deb.nodesource.com/setup_15.x | bash - |
For NodeJs v14.x
1 |
curl -sL https://deb.nodesource.com/setup_14.x | bash - |
For NodeJs v12.x
1 |
curl -sL https://deb.nodesource.com/setup_12.x | bash - |
For NodeJs v11.x
1 |
curl -sL https://deb.nodesource.com/setup_11.x | bash - |
Node.js v10.x
1 |
curl -sL https://deb.nodesource.com/setup_10.x | bash - |
Node.js v9.x
1 |
curl -sL https://deb.nodesource.com/setup_9.x | bash - |
Node.js v8.x
1 |
curl -sL https://deb.nodesource.com/setup_8.x | bash - |
Node.js v6.x
1 |
curl -sL https://deb.nodesource.com/setup_6.x | bash - |
Now install node.js with
1 |
apt-get install -y nodejs |
Some npm modules may need to compile and install native extenion, if you need it
1 |
apt install -y build-essential |
See Node.Js