How to Install Node.js 8 on Ubuntu/Debian/Mint/ElemetaryOS

Share:
how-to-install-node-js-8-on-ubuntu-debian-mint-elemetaryos

Node.js is an open-source, cross-platform Javascript run-time environment that executes Javascript code outside the browser. Historically, Javascript was used primarily for client-side scripting, in which scripts written in JavaScript are embedded in a webpage's HTML and run client-side by a JavaScript engine in the user's web browser. Nowadays, Node.js represents a "JavaScript everywhere" paradigm, unifying web application development around a single programming language, rather than different languages for server side and client side scripts.

Installation

Node.js is available from the NodeSource Debian and Ubuntu binary distributions repository (formerly Chris Lea's Launchpad PPA). Support for this repository, along with its scripts, can be found on GitHub at nodesource/distributions.

Note

  • This guide should cover all Debian and Ubuntu based distributions.
  • The latest Node.js version as the time of writing is 8.11.3.

To install Node.js version 8, enter these commands on your terminal:

$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
$ sudo apt-get install -y nodejs

Alternatively, if you want to install Node.js 10 you could use these commands:

$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
$ sudo apt-get install -y nodejs

To compile and install native addons from npm you may also need to install build tools:

$ sudo apt-get install -y build-essential

Verify Installation

To verify whether your installation is correct:

$ node --version
v8.11.3
$ npm --version
5.6.0

Optional: Update npm Version

npm is a separate project from Node.js, and tends to update more frequently. As a result, even if you’ve just downloaded Node.js (and therefore npm), you’ll probably need to update your npm. Luckily, npm knows how to update itself! To update your npm, type this into your terminal:

$ sudo npm install [email protected] -g
/usr/bin/npm -> /usr/lib/node_modules/npm/bin/npm-cli.js
+ [email protected]
added 283 packages, removed 363 packages and updated 41 packages in 8.961s
$ npm --version
6.3.0

Final Words

I hope that you now know how to install Node.js 8/10 on Linux Mint 18.3. If you run into any issues or have any feedback feel free to drop a comment below.

Tags
Share:

0 comment

Leave a reply

Your email address will not be published. Required fields are marked *