How to install the latest versions of NodeJS and NPM?
I noticed over at the https://nodejs.org/ website that node is currently at v 0.12.0.
Can someone let me know how to install the latest version of node together with npm (terminal commands please)?
software-installation nodejs npm
add a comment |
I noticed over at the https://nodejs.org/ website that node is currently at v 0.12.0.
Can someone let me know how to install the latest version of node together with npm (terminal commands please)?
software-installation nodejs npm
1
What's wrong withsudo apt-get install nodejs
?
– AlikElzin-kilaka
Apr 4 '16 at 7:29
20
^ it installs 1.10.0.
– siliconrockstar
May 7 '16 at 3:10
6
@siliconrockstar that actually installed v0.10.25 on my 14.04 LTS
– Alessandro Cosentino
Jan 3 '17 at 17:00
1
In ubuntu 16 usesudo apt-get install nodejs-legacy
– briankip
Apr 5 '17 at 9:45
add a comment |
I noticed over at the https://nodejs.org/ website that node is currently at v 0.12.0.
Can someone let me know how to install the latest version of node together with npm (terminal commands please)?
software-installation nodejs npm
I noticed over at the https://nodejs.org/ website that node is currently at v 0.12.0.
Can someone let me know how to install the latest version of node together with npm (terminal commands please)?
software-installation nodejs npm
software-installation nodejs npm
edited Feb 25 '18 at 7:58
Ciro Santilli 新疆改造中心 六四事件 法轮功
10.3k44751
10.3k44751
asked Mar 9 '15 at 15:22
tonyftonyf
1,17741118
1,17741118
1
What's wrong withsudo apt-get install nodejs
?
– AlikElzin-kilaka
Apr 4 '16 at 7:29
20
^ it installs 1.10.0.
– siliconrockstar
May 7 '16 at 3:10
6
@siliconrockstar that actually installed v0.10.25 on my 14.04 LTS
– Alessandro Cosentino
Jan 3 '17 at 17:00
1
In ubuntu 16 usesudo apt-get install nodejs-legacy
– briankip
Apr 5 '17 at 9:45
add a comment |
1
What's wrong withsudo apt-get install nodejs
?
– AlikElzin-kilaka
Apr 4 '16 at 7:29
20
^ it installs 1.10.0.
– siliconrockstar
May 7 '16 at 3:10
6
@siliconrockstar that actually installed v0.10.25 on my 14.04 LTS
– Alessandro Cosentino
Jan 3 '17 at 17:00
1
In ubuntu 16 usesudo apt-get install nodejs-legacy
– briankip
Apr 5 '17 at 9:45
1
1
What's wrong with
sudo apt-get install nodejs
?– AlikElzin-kilaka
Apr 4 '16 at 7:29
What's wrong with
sudo apt-get install nodejs
?– AlikElzin-kilaka
Apr 4 '16 at 7:29
20
20
^ it installs 1.10.0.
– siliconrockstar
May 7 '16 at 3:10
^ it installs 1.10.0.
– siliconrockstar
May 7 '16 at 3:10
6
6
@siliconrockstar that actually installed v0.10.25 on my 14.04 LTS
– Alessandro Cosentino
Jan 3 '17 at 17:00
@siliconrockstar that actually installed v0.10.25 on my 14.04 LTS
– Alessandro Cosentino
Jan 3 '17 at 17:00
1
1
In ubuntu 16 use
sudo apt-get install nodejs-legacy
– briankip
Apr 5 '17 at 9:45
In ubuntu 16 use
sudo apt-get install nodejs-legacy
– briankip
Apr 5 '17 at 9:45
add a comment |
19 Answers
19
active
oldest
votes
Fresh installation
Use the NodeSource PPA. For details look at the installation instructions. First, choose the Node.js version you need and add the sources for it:
v=8 # set to 4, 5, 6, ... as needed
curl -sL https://deb.nodesource.com/setup_$v.x | sudo -E bash -
Then install the Node.js package.
sudo apt-get install -y nodejs
P.S.: curl
package must be installed on server for these code lines.
Upgrading
If you have nodejs
already installed and want to update, then first remove current instalation and install it again using scripts above.
sudo apt-get purge nodejs npm
1
NodeSource use two separate PPA: one for 0.10.X version and for 0.12.X. In addition, it contains last npm package.
– 23W
Jun 12 '15 at 8:46
11
didn't work for me. After runningcurl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
then installingnodejs
I ended up withv0.10
– Daithí
Jun 28 '15 at 11:42
44
Curling into root shell is so wrong in so many ways.
– Draco Ater
Apr 12 '16 at 12:36
8
Answer by Guss below should have been the accepted answer. This is not the recommended way to do it.
– Patrick Fabrizius
Aug 30 '16 at 22:38
2
@AlexanderMills the answer provided below (askubuntu.com/a/711976/389358) will get you the latest version of nodejs from NodeSource -- this package includes the latest version of npm as well.
– Keefer Rourke
May 5 '17 at 3:39
|
show 11 more comments
Generally speaking, loading arbitrary data from a URL into a root shell session is not a good idea and I wish people would stop peddling it as a solution for everything - "Please just run this script I'm sending you, and also while we're at it - I have a bridge you'd probably be interested in purchasing".
As an alternative, here's the "Ubuntu Way" of doing the same, where you can see how the system is being updated and know what repositories and what keys are added to your system configuration:
curl https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb https://deb.nodesource.com/node_7.x $(lsb_release -sc) main"
sudo apt-get update
sudo apt-get install nodejs
This is for the latest (at time of writing) Nodejs version 7. Other versions can also be gotten with a simple change to the repo URL - consult nodesource.com documentation for details.
2
I totally agree with your statement, but isn't adding a new repository to apt, the same as running some unknown script? (Though I understand the script in every other answer here, is actually adding that repo by itself)
– Dan
Dec 21 '15 at 13:59
16
The script is adding the repo by itself, and also doing god knows what. It may be completely benign now, but who knows what DNS hijackers or web site exploiters will do in the future? Adding a repo is not the same as running a script of the internet because by itself it does not download any executable code or runs it - it will only do so in response to a specific apt-get install, which will verify the package was signed with a the nodesource key - which is hopefully kept much more securely then the nodesource domain or website. APT security is excellent and has a good track record.
– Guss
Dec 21 '15 at 14:53
1
@Dan, It appears you are running Ubuntu 15.04 (utopic) which is not supported by Node Source, so you get 0.10 from utopic's repositories. Node Source only support LTS releases and the latest non-LTS. Because you are not on an LTS release you're expected to upgrade to the latest version when it came out last October. So either do that, or hack it by changing the$(lsb_release -c)
release autodetection bit to one of the supported releases and deal with the consequences.
– Guss
Feb 8 '16 at 18:24
2
@PaulDraper: Ask nodesource, they're the ones selling bridges they don't own. Myapt-get
solution is the straight dope.
– Guss
Aug 14 '17 at 3:53
1
awesome answer ! in case anyone else is wondering, it just works for newer versions - e.g: just replace 7 with 9
– Mihai Rotaru
Nov 26 '17 at 13:26
|
show 5 more comments
Node.js v4.x:
# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_4.x | bash -
apt-get install -y nodejs
source: https://github.com/nodesource/distributions#debinstall
13
Curling into root shell is so wrong in so many ways.
– Draco Ater
Apr 12 '16 at 12:36
add a comment |
If you want to update inside npm
, you can use the n
command:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
This installs the n package which you can use to switch NodeJS-Versions and uses it. Comparison to the alternative NVM and command options are at SO. There is also a blog post.
1
I've add a NVM step-by-step at: askubuntu.com/a/971612/52975
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Nov 1 '17 at 9:45
1
I'm pretty new to npm and nvm; I'm trying to install npm inside a python virtualenv; does it matter whether I use npm or nvm?nvm install lts/carbon
installs npm and node for me. How is this different from the above commands which you shared?
– kRazzy R
Nov 13 '17 at 19:00
@kRazzyR: you get to choose whether to usenvm
orn
to update NodeJS andnpm
. In both cases, you usenpm
to install node packages.
– serv-inc
Nov 14 '17 at 6:53
add a comment |
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
# Then install with:
sudo apt-get install -y nodejs
Here you can find more info: Node.js v0.12, io.js, and the NodeSource Linux Repositories
add a comment |
For version 5.x According to PPA:
apt-get remove --purge nodejs npm
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
apt-get install nodejs
add a comment |
To install NPM,
sudo apt-get install npm
Then for Node,
sudo npm cache clean -f
sudo npm install -g n
sudo n 0.xx.x // here is the version what you want..
This command will install node based on your version you want..
add a comment |
NVM (Node Version manager)
https://github.com/creationix/nvm
NVM installs both the latest stable node and npm for you
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh
source ~/.nvm/nvm.sh
nvm install --lts
nvm use --lts
npm --version
Now test it out with a dummy package:
npm install --global vaca
vaca
Since the sourcing has to be done for every new shell, you will probably want to add the following to your .bashrc
:
f="$HOME/.nvm/nvm.sh"
if [ -r "$f" ]; then
. "$f" &>'/dev/null'
nvm use --lts &>'/dev/null'
fi
Advantages:
allows you to use multiple versions of Node and without sudo
is analogous to Ruby RVM and Python Virtualenv, widely considered best practice in Ruby and Python communities
downloads a pre-compiled binary where possible, and if not it downloads the source and compiles one for you
We can easily switch node versions with:
nvm install 0.9.0
nvm install 0.9.9
nvm use 0.9.0
node --version
#v0.9.0
nvm use 0.9.9
node --version
#v0.9.9
You can then use a git tracked .nvmrc
file to indicate the node version required for a given project: https://stackoverflow.com/questions/24869959/how-do-i-specify-a-local-version-of-node-for-a-project/54503474#54503474
Tested in Ubuntu 17.10.
add a comment |
You can install latest version very easily using below instruction.
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
Vesion 7.x is the latest version of node.
sudo apt-get install nodejs
Above line will install nodejs.
sudo apt-get install build-essential
This will install essential modules for nodejs to run properly.
Now check whether nodejs installed correctly at your end
nodejs -v
This will return installed nodejs version.
npm -v
This will return installed npm version. Hope it helps....
Source : link will show you how to install nodejs using some other methods as well.
Why installbuild-essential
?
– David Foerster
Nov 29 '16 at 14:30
The nodejs package contains the nodejs binary as well as npm. However, in order for some npm packages to work (such as those that require building from source), you will need to install the build-essentials package
– Jitendra Pawar
Nov 29 '16 at 17:35
add a comment |
Node.js is available as a snap package in all currently supported versions of Ubuntu. Specific to Node.js, developers can choose from one of the currently supported releases and get regular automatic updates directly from NodeSource. Node.js versions 6, 8, 9, 10, 11 and 12 are currently available, with the Snap Store being updated within hours, or minutes of a Node.js release.
Node can be installed with a single command, for example:
sudo snap install node --classic --channel 11/stable
The node snap can be accessed by the command node
, for example:
$ node -v
v11.5.0
An up-to-date version of npm will installed as part of the node snap. npm should be run outside of the node repl, in your normal shell. After installing the node snap run the following command to enable npm update checking:
sudo chown -R $USER:$(id -gn $USER) /home/your-username/.config
Replace your-username
in the above command with your own username. Then run npm -v
to check if the version of npm is up-to-date. As an example I checked that npm was up-to-date, checked the version of an already installed package named yarn with the command npm list yarn
and then updated the existing yarn package to the latest version with the command npm update yarn
Users can switch between versions of Node.js at any time without needing to involve additional tools like nvm (Node Version Manager), for example:
sudo snap refresh node --channel=11/stable
Users can test bleeding-edge versions of Node.js that can be installed from the latest edge channel which is currently tracking Node.js version 12 by switching with:
sudo snap switch node --edge
This approach is only recommended for those users who are willing to participate in testing and bug reporting upstream.
Node.js LTS Schedule
Release LTS Status Codename LTS Start Maintenance Start Maintenance End
6.x Active Boron 2016-10-18 April 2018 April 2019
7.x No LTS
8.x Active Carbon 2017-10-31 April 2019 December 2019
9.x No LTS
10.x Active Dubnium October 2018 April 2020 April 2021
11.x No LTS 2019-04-01 2019-06-30
12.x No LTS 2019-10-22 2021-04-01 2022-04-01
add a comment |
For Ubuntu 15.10 you can download the .deb package form packages.ubuntu.com
node --version
v4.2.3
add a comment |
Just a spin-off of the answer by @23W (accepted answer).
This is just the contents of the script, just to avoid doing curl to root shell.
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
echo "deb https://deb.nodesource.com/node_6.x $(lsb_release -c -s) main" | sudo tee /etc/apt/sources.list.d/nodesource.list
echo "deb-src https://deb.nodesource.com/node_6.x $(lsb_release -c -s) main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install -y nodejs
add a comment |
Download nodejs
from https://nodejs.org/
To install from a terminal:
cd /usr/local
tar --strip-components 1 -xJf ~/Downloads/node-v4.4.5-linux-x64.tar.xz
add a comment |
//Download
cd ~/Downloads
wget https://nodejs.org/dist/v4.4.5/node-v4.4.5-linux-x64.tar.xz
//Install
cd /usr/local
tar --strip-components 1 -xJf ~/Downloads/node-v4.4.5-linux-x64.tar.xz
//Verify
node -v
npm version
Source
add a comment |
My favorite way to install latest nodejs and npm is using the installation binaries archive provided on nodejs' website.
This might quickly become your new favorite way too. Works like a charm. It involves 1 download and 1 command. Done. NO errors [the multiple times I've done this]. Didn't need to uninstall existing stuff beforehand.
Installing nodejs via Binaries
At first remove the installed version: (if exists)
sudo apt-get remove nodejs
Download
https://nodejs.org/en/download/stable/
Download Linux Binaries.
- I had to extract the tar.xz to a folder and then re-compress as tar.gz
Install
sudo tar -C /usr/local --strip-components 1 -xzf /path/to/downloaded/tar/node-vYOURVERSION-linux-x64.tar.gz
Verify
node -v
npm --version
Source
http://www.thegeekstuff.com/2015/10/install-nodejs-npm-linux/
1
Why re-compress as tar.gz?tar
supports--xz
- and-C /usr/local
to lettar
do thecd
for you.
– muru
Apr 14 '16 at 22:28
add a comment |
Video Explanation
NVM is very simple to install and allows you to easily switch node versions. From the github repository:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
downloads and runs the installation script
nvm ls-remote
to see the available versions. Say you want to install version 8.9.4
nvm install 8.9.4
and you're done.
To install another version and use it (say 9.6.1)
nvm install 9.6.1
nvm alias default 9.6.1
add a comment |
This approach allows you easily delete Node.JS, keep different versions and provide the commands to all the system users.
Download the stable version of Node.JS, uncompress it, and move it into /opt
.
In case you wish to install different versions, you can rename the folder according to its version code:
/opt/node/6.9.1
Since only root can change files in /opt
/, if you don't wish to call invoke sudo
every time you need to modify a file, change the group permission:
chgrp adm -R /opt/node/6.9.1
Then create file /etc/profile.d/node.sh
if the following content:
export NODE_ENV=/opt/node/6.9.1
export CPLUS_INCLUDE_PATH=${NODE_ENV}/include
export C_INCLUDE_PATH=${NODE_ENV}/include
export LD_LIBRARY_PATH=${NODE_ENV}/lib
export MANPATH=${NODE_ENV}/share/man:${MANPATH}
export PATH=${NODE_ENV}/bin:$PATH
Logout and login and X-Window will reload all profile configurations.
If you had a previous versions installed, to avoid library conflicts run:
npm cache clean
add a comment |
Update Package Manager
sudo apt-get update
Adding NodeJS PPAs
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
Installing NodeJS and NPM
sudo apt-get install nodejs
Here, I Wrote a Complete Blog post about Installing NodeJS and NPM in Ubuntu.
Click Here to Read
Curling into a root shell is a really bad thing to do in general do to the huge number of security issues this opens up, I would recommend that you update your blog post and your answer to not do this.
– shuttle87
Jul 13 '18 at 11:35
add a comment |
Updating Package Manager
sudo apt-get update
Adding PPA
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
Installing NodeJS and NPM
sudo apt-get install nodejs
For Reference : Installing NodeJS in Ubuntu - WebCheerz
add a comment |
protected by Community♦ Nov 29 '16 at 18:58
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
19 Answers
19
active
oldest
votes
19 Answers
19
active
oldest
votes
active
oldest
votes
active
oldest
votes
Fresh installation
Use the NodeSource PPA. For details look at the installation instructions. First, choose the Node.js version you need and add the sources for it:
v=8 # set to 4, 5, 6, ... as needed
curl -sL https://deb.nodesource.com/setup_$v.x | sudo -E bash -
Then install the Node.js package.
sudo apt-get install -y nodejs
P.S.: curl
package must be installed on server for these code lines.
Upgrading
If you have nodejs
already installed and want to update, then first remove current instalation and install it again using scripts above.
sudo apt-get purge nodejs npm
1
NodeSource use two separate PPA: one for 0.10.X version and for 0.12.X. In addition, it contains last npm package.
– 23W
Jun 12 '15 at 8:46
11
didn't work for me. After runningcurl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
then installingnodejs
I ended up withv0.10
– Daithí
Jun 28 '15 at 11:42
44
Curling into root shell is so wrong in so many ways.
– Draco Ater
Apr 12 '16 at 12:36
8
Answer by Guss below should have been the accepted answer. This is not the recommended way to do it.
– Patrick Fabrizius
Aug 30 '16 at 22:38
2
@AlexanderMills the answer provided below (askubuntu.com/a/711976/389358) will get you the latest version of nodejs from NodeSource -- this package includes the latest version of npm as well.
– Keefer Rourke
May 5 '17 at 3:39
|
show 11 more comments
Fresh installation
Use the NodeSource PPA. For details look at the installation instructions. First, choose the Node.js version you need and add the sources for it:
v=8 # set to 4, 5, 6, ... as needed
curl -sL https://deb.nodesource.com/setup_$v.x | sudo -E bash -
Then install the Node.js package.
sudo apt-get install -y nodejs
P.S.: curl
package must be installed on server for these code lines.
Upgrading
If you have nodejs
already installed and want to update, then first remove current instalation and install it again using scripts above.
sudo apt-get purge nodejs npm
1
NodeSource use two separate PPA: one for 0.10.X version and for 0.12.X. In addition, it contains last npm package.
– 23W
Jun 12 '15 at 8:46
11
didn't work for me. After runningcurl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
then installingnodejs
I ended up withv0.10
– Daithí
Jun 28 '15 at 11:42
44
Curling into root shell is so wrong in so many ways.
– Draco Ater
Apr 12 '16 at 12:36
8
Answer by Guss below should have been the accepted answer. This is not the recommended way to do it.
– Patrick Fabrizius
Aug 30 '16 at 22:38
2
@AlexanderMills the answer provided below (askubuntu.com/a/711976/389358) will get you the latest version of nodejs from NodeSource -- this package includes the latest version of npm as well.
– Keefer Rourke
May 5 '17 at 3:39
|
show 11 more comments
Fresh installation
Use the NodeSource PPA. For details look at the installation instructions. First, choose the Node.js version you need and add the sources for it:
v=8 # set to 4, 5, 6, ... as needed
curl -sL https://deb.nodesource.com/setup_$v.x | sudo -E bash -
Then install the Node.js package.
sudo apt-get install -y nodejs
P.S.: curl
package must be installed on server for these code lines.
Upgrading
If you have nodejs
already installed and want to update, then first remove current instalation and install it again using scripts above.
sudo apt-get purge nodejs npm
Fresh installation
Use the NodeSource PPA. For details look at the installation instructions. First, choose the Node.js version you need and add the sources for it:
v=8 # set to 4, 5, 6, ... as needed
curl -sL https://deb.nodesource.com/setup_$v.x | sudo -E bash -
Then install the Node.js package.
sudo apt-get install -y nodejs
P.S.: curl
package must be installed on server for these code lines.
Upgrading
If you have nodejs
already installed and want to update, then first remove current instalation and install it again using scripts above.
sudo apt-get purge nodejs npm
edited Nov 14 '17 at 7:26
muru
1
1
answered Jun 12 '15 at 8:18
23W23W
2,7091911
2,7091911
1
NodeSource use two separate PPA: one for 0.10.X version and for 0.12.X. In addition, it contains last npm package.
– 23W
Jun 12 '15 at 8:46
11
didn't work for me. After runningcurl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
then installingnodejs
I ended up withv0.10
– Daithí
Jun 28 '15 at 11:42
44
Curling into root shell is so wrong in so many ways.
– Draco Ater
Apr 12 '16 at 12:36
8
Answer by Guss below should have been the accepted answer. This is not the recommended way to do it.
– Patrick Fabrizius
Aug 30 '16 at 22:38
2
@AlexanderMills the answer provided below (askubuntu.com/a/711976/389358) will get you the latest version of nodejs from NodeSource -- this package includes the latest version of npm as well.
– Keefer Rourke
May 5 '17 at 3:39
|
show 11 more comments
1
NodeSource use two separate PPA: one for 0.10.X version and for 0.12.X. In addition, it contains last npm package.
– 23W
Jun 12 '15 at 8:46
11
didn't work for me. After runningcurl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
then installingnodejs
I ended up withv0.10
– Daithí
Jun 28 '15 at 11:42
44
Curling into root shell is so wrong in so many ways.
– Draco Ater
Apr 12 '16 at 12:36
8
Answer by Guss below should have been the accepted answer. This is not the recommended way to do it.
– Patrick Fabrizius
Aug 30 '16 at 22:38
2
@AlexanderMills the answer provided below (askubuntu.com/a/711976/389358) will get you the latest version of nodejs from NodeSource -- this package includes the latest version of npm as well.
– Keefer Rourke
May 5 '17 at 3:39
1
1
NodeSource use two separate PPA: one for 0.10.X version and for 0.12.X. In addition, it contains last npm package.
– 23W
Jun 12 '15 at 8:46
NodeSource use two separate PPA: one for 0.10.X version and for 0.12.X. In addition, it contains last npm package.
– 23W
Jun 12 '15 at 8:46
11
11
didn't work for me. After running
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
then installing nodejs
I ended up with v0.10
– Daithí
Jun 28 '15 at 11:42
didn't work for me. After running
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
then installing nodejs
I ended up with v0.10
– Daithí
Jun 28 '15 at 11:42
44
44
Curling into root shell is so wrong in so many ways.
– Draco Ater
Apr 12 '16 at 12:36
Curling into root shell is so wrong in so many ways.
– Draco Ater
Apr 12 '16 at 12:36
8
8
Answer by Guss below should have been the accepted answer. This is not the recommended way to do it.
– Patrick Fabrizius
Aug 30 '16 at 22:38
Answer by Guss below should have been the accepted answer. This is not the recommended way to do it.
– Patrick Fabrizius
Aug 30 '16 at 22:38
2
2
@AlexanderMills the answer provided below (askubuntu.com/a/711976/389358) will get you the latest version of nodejs from NodeSource -- this package includes the latest version of npm as well.
– Keefer Rourke
May 5 '17 at 3:39
@AlexanderMills the answer provided below (askubuntu.com/a/711976/389358) will get you the latest version of nodejs from NodeSource -- this package includes the latest version of npm as well.
– Keefer Rourke
May 5 '17 at 3:39
|
show 11 more comments
Generally speaking, loading arbitrary data from a URL into a root shell session is not a good idea and I wish people would stop peddling it as a solution for everything - "Please just run this script I'm sending you, and also while we're at it - I have a bridge you'd probably be interested in purchasing".
As an alternative, here's the "Ubuntu Way" of doing the same, where you can see how the system is being updated and know what repositories and what keys are added to your system configuration:
curl https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb https://deb.nodesource.com/node_7.x $(lsb_release -sc) main"
sudo apt-get update
sudo apt-get install nodejs
This is for the latest (at time of writing) Nodejs version 7. Other versions can also be gotten with a simple change to the repo URL - consult nodesource.com documentation for details.
2
I totally agree with your statement, but isn't adding a new repository to apt, the same as running some unknown script? (Though I understand the script in every other answer here, is actually adding that repo by itself)
– Dan
Dec 21 '15 at 13:59
16
The script is adding the repo by itself, and also doing god knows what. It may be completely benign now, but who knows what DNS hijackers or web site exploiters will do in the future? Adding a repo is not the same as running a script of the internet because by itself it does not download any executable code or runs it - it will only do so in response to a specific apt-get install, which will verify the package was signed with a the nodesource key - which is hopefully kept much more securely then the nodesource domain or website. APT security is excellent and has a good track record.
– Guss
Dec 21 '15 at 14:53
1
@Dan, It appears you are running Ubuntu 15.04 (utopic) which is not supported by Node Source, so you get 0.10 from utopic's repositories. Node Source only support LTS releases and the latest non-LTS. Because you are not on an LTS release you're expected to upgrade to the latest version when it came out last October. So either do that, or hack it by changing the$(lsb_release -c)
release autodetection bit to one of the supported releases and deal with the consequences.
– Guss
Feb 8 '16 at 18:24
2
@PaulDraper: Ask nodesource, they're the ones selling bridges they don't own. Myapt-get
solution is the straight dope.
– Guss
Aug 14 '17 at 3:53
1
awesome answer ! in case anyone else is wondering, it just works for newer versions - e.g: just replace 7 with 9
– Mihai Rotaru
Nov 26 '17 at 13:26
|
show 5 more comments
Generally speaking, loading arbitrary data from a URL into a root shell session is not a good idea and I wish people would stop peddling it as a solution for everything - "Please just run this script I'm sending you, and also while we're at it - I have a bridge you'd probably be interested in purchasing".
As an alternative, here's the "Ubuntu Way" of doing the same, where you can see how the system is being updated and know what repositories and what keys are added to your system configuration:
curl https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb https://deb.nodesource.com/node_7.x $(lsb_release -sc) main"
sudo apt-get update
sudo apt-get install nodejs
This is for the latest (at time of writing) Nodejs version 7. Other versions can also be gotten with a simple change to the repo URL - consult nodesource.com documentation for details.
2
I totally agree with your statement, but isn't adding a new repository to apt, the same as running some unknown script? (Though I understand the script in every other answer here, is actually adding that repo by itself)
– Dan
Dec 21 '15 at 13:59
16
The script is adding the repo by itself, and also doing god knows what. It may be completely benign now, but who knows what DNS hijackers or web site exploiters will do in the future? Adding a repo is not the same as running a script of the internet because by itself it does not download any executable code or runs it - it will only do so in response to a specific apt-get install, which will verify the package was signed with a the nodesource key - which is hopefully kept much more securely then the nodesource domain or website. APT security is excellent and has a good track record.
– Guss
Dec 21 '15 at 14:53
1
@Dan, It appears you are running Ubuntu 15.04 (utopic) which is not supported by Node Source, so you get 0.10 from utopic's repositories. Node Source only support LTS releases and the latest non-LTS. Because you are not on an LTS release you're expected to upgrade to the latest version when it came out last October. So either do that, or hack it by changing the$(lsb_release -c)
release autodetection bit to one of the supported releases and deal with the consequences.
– Guss
Feb 8 '16 at 18:24
2
@PaulDraper: Ask nodesource, they're the ones selling bridges they don't own. Myapt-get
solution is the straight dope.
– Guss
Aug 14 '17 at 3:53
1
awesome answer ! in case anyone else is wondering, it just works for newer versions - e.g: just replace 7 with 9
– Mihai Rotaru
Nov 26 '17 at 13:26
|
show 5 more comments
Generally speaking, loading arbitrary data from a URL into a root shell session is not a good idea and I wish people would stop peddling it as a solution for everything - "Please just run this script I'm sending you, and also while we're at it - I have a bridge you'd probably be interested in purchasing".
As an alternative, here's the "Ubuntu Way" of doing the same, where you can see how the system is being updated and know what repositories and what keys are added to your system configuration:
curl https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb https://deb.nodesource.com/node_7.x $(lsb_release -sc) main"
sudo apt-get update
sudo apt-get install nodejs
This is for the latest (at time of writing) Nodejs version 7. Other versions can also be gotten with a simple change to the repo URL - consult nodesource.com documentation for details.
Generally speaking, loading arbitrary data from a URL into a root shell session is not a good idea and I wish people would stop peddling it as a solution for everything - "Please just run this script I'm sending you, and also while we're at it - I have a bridge you'd probably be interested in purchasing".
As an alternative, here's the "Ubuntu Way" of doing the same, where you can see how the system is being updated and know what repositories and what keys are added to your system configuration:
curl https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb https://deb.nodesource.com/node_7.x $(lsb_release -sc) main"
sudo apt-get update
sudo apt-get install nodejs
This is for the latest (at time of writing) Nodejs version 7. Other versions can also be gotten with a simple change to the repo URL - consult nodesource.com documentation for details.
edited Sep 26 '18 at 14:05
community wiki
5 revs, 4 users 69%
Guss
2
I totally agree with your statement, but isn't adding a new repository to apt, the same as running some unknown script? (Though I understand the script in every other answer here, is actually adding that repo by itself)
– Dan
Dec 21 '15 at 13:59
16
The script is adding the repo by itself, and also doing god knows what. It may be completely benign now, but who knows what DNS hijackers or web site exploiters will do in the future? Adding a repo is not the same as running a script of the internet because by itself it does not download any executable code or runs it - it will only do so in response to a specific apt-get install, which will verify the package was signed with a the nodesource key - which is hopefully kept much more securely then the nodesource domain or website. APT security is excellent and has a good track record.
– Guss
Dec 21 '15 at 14:53
1
@Dan, It appears you are running Ubuntu 15.04 (utopic) which is not supported by Node Source, so you get 0.10 from utopic's repositories. Node Source only support LTS releases and the latest non-LTS. Because you are not on an LTS release you're expected to upgrade to the latest version when it came out last October. So either do that, or hack it by changing the$(lsb_release -c)
release autodetection bit to one of the supported releases and deal with the consequences.
– Guss
Feb 8 '16 at 18:24
2
@PaulDraper: Ask nodesource, they're the ones selling bridges they don't own. Myapt-get
solution is the straight dope.
– Guss
Aug 14 '17 at 3:53
1
awesome answer ! in case anyone else is wondering, it just works for newer versions - e.g: just replace 7 with 9
– Mihai Rotaru
Nov 26 '17 at 13:26
|
show 5 more comments
2
I totally agree with your statement, but isn't adding a new repository to apt, the same as running some unknown script? (Though I understand the script in every other answer here, is actually adding that repo by itself)
– Dan
Dec 21 '15 at 13:59
16
The script is adding the repo by itself, and also doing god knows what. It may be completely benign now, but who knows what DNS hijackers or web site exploiters will do in the future? Adding a repo is not the same as running a script of the internet because by itself it does not download any executable code or runs it - it will only do so in response to a specific apt-get install, which will verify the package was signed with a the nodesource key - which is hopefully kept much more securely then the nodesource domain or website. APT security is excellent and has a good track record.
– Guss
Dec 21 '15 at 14:53
1
@Dan, It appears you are running Ubuntu 15.04 (utopic) which is not supported by Node Source, so you get 0.10 from utopic's repositories. Node Source only support LTS releases and the latest non-LTS. Because you are not on an LTS release you're expected to upgrade to the latest version when it came out last October. So either do that, or hack it by changing the$(lsb_release -c)
release autodetection bit to one of the supported releases and deal with the consequences.
– Guss
Feb 8 '16 at 18:24
2
@PaulDraper: Ask nodesource, they're the ones selling bridges they don't own. Myapt-get
solution is the straight dope.
– Guss
Aug 14 '17 at 3:53
1
awesome answer ! in case anyone else is wondering, it just works for newer versions - e.g: just replace 7 with 9
– Mihai Rotaru
Nov 26 '17 at 13:26
2
2
I totally agree with your statement, but isn't adding a new repository to apt, the same as running some unknown script? (Though I understand the script in every other answer here, is actually adding that repo by itself)
– Dan
Dec 21 '15 at 13:59
I totally agree with your statement, but isn't adding a new repository to apt, the same as running some unknown script? (Though I understand the script in every other answer here, is actually adding that repo by itself)
– Dan
Dec 21 '15 at 13:59
16
16
The script is adding the repo by itself, and also doing god knows what. It may be completely benign now, but who knows what DNS hijackers or web site exploiters will do in the future? Adding a repo is not the same as running a script of the internet because by itself it does not download any executable code or runs it - it will only do so in response to a specific apt-get install, which will verify the package was signed with a the nodesource key - which is hopefully kept much more securely then the nodesource domain or website. APT security is excellent and has a good track record.
– Guss
Dec 21 '15 at 14:53
The script is adding the repo by itself, and also doing god knows what. It may be completely benign now, but who knows what DNS hijackers or web site exploiters will do in the future? Adding a repo is not the same as running a script of the internet because by itself it does not download any executable code or runs it - it will only do so in response to a specific apt-get install, which will verify the package was signed with a the nodesource key - which is hopefully kept much more securely then the nodesource domain or website. APT security is excellent and has a good track record.
– Guss
Dec 21 '15 at 14:53
1
1
@Dan, It appears you are running Ubuntu 15.04 (utopic) which is not supported by Node Source, so you get 0.10 from utopic's repositories. Node Source only support LTS releases and the latest non-LTS. Because you are not on an LTS release you're expected to upgrade to the latest version when it came out last October. So either do that, or hack it by changing the
$(lsb_release -c)
release autodetection bit to one of the supported releases and deal with the consequences.– Guss
Feb 8 '16 at 18:24
@Dan, It appears you are running Ubuntu 15.04 (utopic) which is not supported by Node Source, so you get 0.10 from utopic's repositories. Node Source only support LTS releases and the latest non-LTS. Because you are not on an LTS release you're expected to upgrade to the latest version when it came out last October. So either do that, or hack it by changing the
$(lsb_release -c)
release autodetection bit to one of the supported releases and deal with the consequences.– Guss
Feb 8 '16 at 18:24
2
2
@PaulDraper: Ask nodesource, they're the ones selling bridges they don't own. My
apt-get
solution is the straight dope.– Guss
Aug 14 '17 at 3:53
@PaulDraper: Ask nodesource, they're the ones selling bridges they don't own. My
apt-get
solution is the straight dope.– Guss
Aug 14 '17 at 3:53
1
1
awesome answer ! in case anyone else is wondering, it just works for newer versions - e.g: just replace 7 with 9
– Mihai Rotaru
Nov 26 '17 at 13:26
awesome answer ! in case anyone else is wondering, it just works for newer versions - e.g: just replace 7 with 9
– Mihai Rotaru
Nov 26 '17 at 13:26
|
show 5 more comments
Node.js v4.x:
# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_4.x | bash -
apt-get install -y nodejs
source: https://github.com/nodesource/distributions#debinstall
13
Curling into root shell is so wrong in so many ways.
– Draco Ater
Apr 12 '16 at 12:36
add a comment |
Node.js v4.x:
# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_4.x | bash -
apt-get install -y nodejs
source: https://github.com/nodesource/distributions#debinstall
13
Curling into root shell is so wrong in so many ways.
– Draco Ater
Apr 12 '16 at 12:36
add a comment |
Node.js v4.x:
# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_4.x | bash -
apt-get install -y nodejs
source: https://github.com/nodesource/distributions#debinstall
Node.js v4.x:
# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_4.x | bash -
apt-get install -y nodejs
source: https://github.com/nodesource/distributions#debinstall
edited Nov 2 '15 at 3:37
PowerKiKi
25339
25339
answered Sep 15 '15 at 17:21
Yosvel QuinteroYosvel Quintero
439155
439155
13
Curling into root shell is so wrong in so many ways.
– Draco Ater
Apr 12 '16 at 12:36
add a comment |
13
Curling into root shell is so wrong in so many ways.
– Draco Ater
Apr 12 '16 at 12:36
13
13
Curling into root shell is so wrong in so many ways.
– Draco Ater
Apr 12 '16 at 12:36
Curling into root shell is so wrong in so many ways.
– Draco Ater
Apr 12 '16 at 12:36
add a comment |
If you want to update inside npm
, you can use the n
command:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
This installs the n package which you can use to switch NodeJS-Versions and uses it. Comparison to the alternative NVM and command options are at SO. There is also a blog post.
1
I've add a NVM step-by-step at: askubuntu.com/a/971612/52975
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Nov 1 '17 at 9:45
1
I'm pretty new to npm and nvm; I'm trying to install npm inside a python virtualenv; does it matter whether I use npm or nvm?nvm install lts/carbon
installs npm and node for me. How is this different from the above commands which you shared?
– kRazzy R
Nov 13 '17 at 19:00
@kRazzyR: you get to choose whether to usenvm
orn
to update NodeJS andnpm
. In both cases, you usenpm
to install node packages.
– serv-inc
Nov 14 '17 at 6:53
add a comment |
If you want to update inside npm
, you can use the n
command:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
This installs the n package which you can use to switch NodeJS-Versions and uses it. Comparison to the alternative NVM and command options are at SO. There is also a blog post.
1
I've add a NVM step-by-step at: askubuntu.com/a/971612/52975
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Nov 1 '17 at 9:45
1
I'm pretty new to npm and nvm; I'm trying to install npm inside a python virtualenv; does it matter whether I use npm or nvm?nvm install lts/carbon
installs npm and node for me. How is this different from the above commands which you shared?
– kRazzy R
Nov 13 '17 at 19:00
@kRazzyR: you get to choose whether to usenvm
orn
to update NodeJS andnpm
. In both cases, you usenpm
to install node packages.
– serv-inc
Nov 14 '17 at 6:53
add a comment |
If you want to update inside npm
, you can use the n
command:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
This installs the n package which you can use to switch NodeJS-Versions and uses it. Comparison to the alternative NVM and command options are at SO. There is also a blog post.
If you want to update inside npm
, you can use the n
command:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
This installs the n package which you can use to switch NodeJS-Versions and uses it. Comparison to the alternative NVM and command options are at SO. There is also a blog post.
edited Nov 14 '17 at 6:51
answered Aug 18 '15 at 18:15
serv-incserv-inc
1,6651420
1,6651420
1
I've add a NVM step-by-step at: askubuntu.com/a/971612/52975
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Nov 1 '17 at 9:45
1
I'm pretty new to npm and nvm; I'm trying to install npm inside a python virtualenv; does it matter whether I use npm or nvm?nvm install lts/carbon
installs npm and node for me. How is this different from the above commands which you shared?
– kRazzy R
Nov 13 '17 at 19:00
@kRazzyR: you get to choose whether to usenvm
orn
to update NodeJS andnpm
. In both cases, you usenpm
to install node packages.
– serv-inc
Nov 14 '17 at 6:53
add a comment |
1
I've add a NVM step-by-step at: askubuntu.com/a/971612/52975
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Nov 1 '17 at 9:45
1
I'm pretty new to npm and nvm; I'm trying to install npm inside a python virtualenv; does it matter whether I use npm or nvm?nvm install lts/carbon
installs npm and node for me. How is this different from the above commands which you shared?
– kRazzy R
Nov 13 '17 at 19:00
@kRazzyR: you get to choose whether to usenvm
orn
to update NodeJS andnpm
. In both cases, you usenpm
to install node packages.
– serv-inc
Nov 14 '17 at 6:53
1
1
I've add a NVM step-by-step at: askubuntu.com/a/971612/52975
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Nov 1 '17 at 9:45
I've add a NVM step-by-step at: askubuntu.com/a/971612/52975
– Ciro Santilli 新疆改造中心 六四事件 法轮功
Nov 1 '17 at 9:45
1
1
I'm pretty new to npm and nvm; I'm trying to install npm inside a python virtualenv; does it matter whether I use npm or nvm?
nvm install lts/carbon
installs npm and node for me. How is this different from the above commands which you shared?– kRazzy R
Nov 13 '17 at 19:00
I'm pretty new to npm and nvm; I'm trying to install npm inside a python virtualenv; does it matter whether I use npm or nvm?
nvm install lts/carbon
installs npm and node for me. How is this different from the above commands which you shared?– kRazzy R
Nov 13 '17 at 19:00
@kRazzyR: you get to choose whether to use
nvm
or n
to update NodeJS and npm
. In both cases, you use npm
to install node packages.– serv-inc
Nov 14 '17 at 6:53
@kRazzyR: you get to choose whether to use
nvm
or n
to update NodeJS and npm
. In both cases, you use npm
to install node packages.– serv-inc
Nov 14 '17 at 6:53
add a comment |
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
# Then install with:
sudo apt-get install -y nodejs
Here you can find more info: Node.js v0.12, io.js, and the NodeSource Linux Repositories
add a comment |
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
# Then install with:
sudo apt-get install -y nodejs
Here you can find more info: Node.js v0.12, io.js, and the NodeSource Linux Repositories
add a comment |
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
# Then install with:
sudo apt-get install -y nodejs
Here you can find more info: Node.js v0.12, io.js, and the NodeSource Linux Repositories
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
# Then install with:
sudo apt-get install -y nodejs
Here you can find more info: Node.js v0.12, io.js, and the NodeSource Linux Repositories
answered May 29 '15 at 20:40
Jaime Leonardo Suncin CruzJaime Leonardo Suncin Cruz
8712
8712
add a comment |
add a comment |
For version 5.x According to PPA:
apt-get remove --purge nodejs npm
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
apt-get install nodejs
add a comment |
For version 5.x According to PPA:
apt-get remove --purge nodejs npm
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
apt-get install nodejs
add a comment |
For version 5.x According to PPA:
apt-get remove --purge nodejs npm
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
apt-get install nodejs
For version 5.x According to PPA:
apt-get remove --purge nodejs npm
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
apt-get install nodejs
answered Dec 6 '15 at 9:42
GuySoftGuySoft
634614
634614
add a comment |
add a comment |
To install NPM,
sudo apt-get install npm
Then for Node,
sudo npm cache clean -f
sudo npm install -g n
sudo n 0.xx.x // here is the version what you want..
This command will install node based on your version you want..
add a comment |
To install NPM,
sudo apt-get install npm
Then for Node,
sudo npm cache clean -f
sudo npm install -g n
sudo n 0.xx.x // here is the version what you want..
This command will install node based on your version you want..
add a comment |
To install NPM,
sudo apt-get install npm
Then for Node,
sudo npm cache clean -f
sudo npm install -g n
sudo n 0.xx.x // here is the version what you want..
This command will install node based on your version you want..
To install NPM,
sudo apt-get install npm
Then for Node,
sudo npm cache clean -f
sudo npm install -g n
sudo n 0.xx.x // here is the version what you want..
This command will install node based on your version you want..
answered Apr 7 '16 at 13:29
Mohideen ibn MohammedMohideen ibn Mohammed
175110
175110
add a comment |
add a comment |
NVM (Node Version manager)
https://github.com/creationix/nvm
NVM installs both the latest stable node and npm for you
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh
source ~/.nvm/nvm.sh
nvm install --lts
nvm use --lts
npm --version
Now test it out with a dummy package:
npm install --global vaca
vaca
Since the sourcing has to be done for every new shell, you will probably want to add the following to your .bashrc
:
f="$HOME/.nvm/nvm.sh"
if [ -r "$f" ]; then
. "$f" &>'/dev/null'
nvm use --lts &>'/dev/null'
fi
Advantages:
allows you to use multiple versions of Node and without sudo
is analogous to Ruby RVM and Python Virtualenv, widely considered best practice in Ruby and Python communities
downloads a pre-compiled binary where possible, and if not it downloads the source and compiles one for you
We can easily switch node versions with:
nvm install 0.9.0
nvm install 0.9.9
nvm use 0.9.0
node --version
#v0.9.0
nvm use 0.9.9
node --version
#v0.9.9
You can then use a git tracked .nvmrc
file to indicate the node version required for a given project: https://stackoverflow.com/questions/24869959/how-do-i-specify-a-local-version-of-node-for-a-project/54503474#54503474
Tested in Ubuntu 17.10.
add a comment |
NVM (Node Version manager)
https://github.com/creationix/nvm
NVM installs both the latest stable node and npm for you
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh
source ~/.nvm/nvm.sh
nvm install --lts
nvm use --lts
npm --version
Now test it out with a dummy package:
npm install --global vaca
vaca
Since the sourcing has to be done for every new shell, you will probably want to add the following to your .bashrc
:
f="$HOME/.nvm/nvm.sh"
if [ -r "$f" ]; then
. "$f" &>'/dev/null'
nvm use --lts &>'/dev/null'
fi
Advantages:
allows you to use multiple versions of Node and without sudo
is analogous to Ruby RVM and Python Virtualenv, widely considered best practice in Ruby and Python communities
downloads a pre-compiled binary where possible, and if not it downloads the source and compiles one for you
We can easily switch node versions with:
nvm install 0.9.0
nvm install 0.9.9
nvm use 0.9.0
node --version
#v0.9.0
nvm use 0.9.9
node --version
#v0.9.9
You can then use a git tracked .nvmrc
file to indicate the node version required for a given project: https://stackoverflow.com/questions/24869959/how-do-i-specify-a-local-version-of-node-for-a-project/54503474#54503474
Tested in Ubuntu 17.10.
add a comment |
NVM (Node Version manager)
https://github.com/creationix/nvm
NVM installs both the latest stable node and npm for you
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh
source ~/.nvm/nvm.sh
nvm install --lts
nvm use --lts
npm --version
Now test it out with a dummy package:
npm install --global vaca
vaca
Since the sourcing has to be done for every new shell, you will probably want to add the following to your .bashrc
:
f="$HOME/.nvm/nvm.sh"
if [ -r "$f" ]; then
. "$f" &>'/dev/null'
nvm use --lts &>'/dev/null'
fi
Advantages:
allows you to use multiple versions of Node and without sudo
is analogous to Ruby RVM and Python Virtualenv, widely considered best practice in Ruby and Python communities
downloads a pre-compiled binary where possible, and if not it downloads the source and compiles one for you
We can easily switch node versions with:
nvm install 0.9.0
nvm install 0.9.9
nvm use 0.9.0
node --version
#v0.9.0
nvm use 0.9.9
node --version
#v0.9.9
You can then use a git tracked .nvmrc
file to indicate the node version required for a given project: https://stackoverflow.com/questions/24869959/how-do-i-specify-a-local-version-of-node-for-a-project/54503474#54503474
Tested in Ubuntu 17.10.
NVM (Node Version manager)
https://github.com/creationix/nvm
NVM installs both the latest stable node and npm for you
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh
source ~/.nvm/nvm.sh
nvm install --lts
nvm use --lts
npm --version
Now test it out with a dummy package:
npm install --global vaca
vaca
Since the sourcing has to be done for every new shell, you will probably want to add the following to your .bashrc
:
f="$HOME/.nvm/nvm.sh"
if [ -r "$f" ]; then
. "$f" &>'/dev/null'
nvm use --lts &>'/dev/null'
fi
Advantages:
allows you to use multiple versions of Node and without sudo
is analogous to Ruby RVM and Python Virtualenv, widely considered best practice in Ruby and Python communities
downloads a pre-compiled binary where possible, and if not it downloads the source and compiles one for you
We can easily switch node versions with:
nvm install 0.9.0
nvm install 0.9.9
nvm use 0.9.0
node --version
#v0.9.0
nvm use 0.9.9
node --version
#v0.9.9
You can then use a git tracked .nvmrc
file to indicate the node version required for a given project: https://stackoverflow.com/questions/24869959/how-do-i-specify-a-local-version-of-node-for-a-project/54503474#54503474
Tested in Ubuntu 17.10.
edited Feb 3 at 13:44
answered Nov 1 '17 at 9:42
Ciro Santilli 新疆改造中心 六四事件 法轮功Ciro Santilli 新疆改造中心 六四事件 法轮功
10.3k44751
10.3k44751
add a comment |
add a comment |
You can install latest version very easily using below instruction.
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
Vesion 7.x is the latest version of node.
sudo apt-get install nodejs
Above line will install nodejs.
sudo apt-get install build-essential
This will install essential modules for nodejs to run properly.
Now check whether nodejs installed correctly at your end
nodejs -v
This will return installed nodejs version.
npm -v
This will return installed npm version. Hope it helps....
Source : link will show you how to install nodejs using some other methods as well.
Why installbuild-essential
?
– David Foerster
Nov 29 '16 at 14:30
The nodejs package contains the nodejs binary as well as npm. However, in order for some npm packages to work (such as those that require building from source), you will need to install the build-essentials package
– Jitendra Pawar
Nov 29 '16 at 17:35
add a comment |
You can install latest version very easily using below instruction.
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
Vesion 7.x is the latest version of node.
sudo apt-get install nodejs
Above line will install nodejs.
sudo apt-get install build-essential
This will install essential modules for nodejs to run properly.
Now check whether nodejs installed correctly at your end
nodejs -v
This will return installed nodejs version.
npm -v
This will return installed npm version. Hope it helps....
Source : link will show you how to install nodejs using some other methods as well.
Why installbuild-essential
?
– David Foerster
Nov 29 '16 at 14:30
The nodejs package contains the nodejs binary as well as npm. However, in order for some npm packages to work (such as those that require building from source), you will need to install the build-essentials package
– Jitendra Pawar
Nov 29 '16 at 17:35
add a comment |
You can install latest version very easily using below instruction.
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
Vesion 7.x is the latest version of node.
sudo apt-get install nodejs
Above line will install nodejs.
sudo apt-get install build-essential
This will install essential modules for nodejs to run properly.
Now check whether nodejs installed correctly at your end
nodejs -v
This will return installed nodejs version.
npm -v
This will return installed npm version. Hope it helps....
Source : link will show you how to install nodejs using some other methods as well.
You can install latest version very easily using below instruction.
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
Vesion 7.x is the latest version of node.
sudo apt-get install nodejs
Above line will install nodejs.
sudo apt-get install build-essential
This will install essential modules for nodejs to run properly.
Now check whether nodejs installed correctly at your end
nodejs -v
This will return installed nodejs version.
npm -v
This will return installed npm version. Hope it helps....
Source : link will show you how to install nodejs using some other methods as well.
edited Nov 29 '16 at 17:38
answered Nov 29 '16 at 13:55
Jitendra PawarJitendra Pawar
1535
1535
Why installbuild-essential
?
– David Foerster
Nov 29 '16 at 14:30
The nodejs package contains the nodejs binary as well as npm. However, in order for some npm packages to work (such as those that require building from source), you will need to install the build-essentials package
– Jitendra Pawar
Nov 29 '16 at 17:35
add a comment |
Why installbuild-essential
?
– David Foerster
Nov 29 '16 at 14:30
The nodejs package contains the nodejs binary as well as npm. However, in order for some npm packages to work (such as those that require building from source), you will need to install the build-essentials package
– Jitendra Pawar
Nov 29 '16 at 17:35
Why install
build-essential
?– David Foerster
Nov 29 '16 at 14:30
Why install
build-essential
?– David Foerster
Nov 29 '16 at 14:30
The nodejs package contains the nodejs binary as well as npm. However, in order for some npm packages to work (such as those that require building from source), you will need to install the build-essentials package
– Jitendra Pawar
Nov 29 '16 at 17:35
The nodejs package contains the nodejs binary as well as npm. However, in order for some npm packages to work (such as those that require building from source), you will need to install the build-essentials package
– Jitendra Pawar
Nov 29 '16 at 17:35
add a comment |
Node.js is available as a snap package in all currently supported versions of Ubuntu. Specific to Node.js, developers can choose from one of the currently supported releases and get regular automatic updates directly from NodeSource. Node.js versions 6, 8, 9, 10, 11 and 12 are currently available, with the Snap Store being updated within hours, or minutes of a Node.js release.
Node can be installed with a single command, for example:
sudo snap install node --classic --channel 11/stable
The node snap can be accessed by the command node
, for example:
$ node -v
v11.5.0
An up-to-date version of npm will installed as part of the node snap. npm should be run outside of the node repl, in your normal shell. After installing the node snap run the following command to enable npm update checking:
sudo chown -R $USER:$(id -gn $USER) /home/your-username/.config
Replace your-username
in the above command with your own username. Then run npm -v
to check if the version of npm is up-to-date. As an example I checked that npm was up-to-date, checked the version of an already installed package named yarn with the command npm list yarn
and then updated the existing yarn package to the latest version with the command npm update yarn
Users can switch between versions of Node.js at any time without needing to involve additional tools like nvm (Node Version Manager), for example:
sudo snap refresh node --channel=11/stable
Users can test bleeding-edge versions of Node.js that can be installed from the latest edge channel which is currently tracking Node.js version 12 by switching with:
sudo snap switch node --edge
This approach is only recommended for those users who are willing to participate in testing and bug reporting upstream.
Node.js LTS Schedule
Release LTS Status Codename LTS Start Maintenance Start Maintenance End
6.x Active Boron 2016-10-18 April 2018 April 2019
7.x No LTS
8.x Active Carbon 2017-10-31 April 2019 December 2019
9.x No LTS
10.x Active Dubnium October 2018 April 2020 April 2021
11.x No LTS 2019-04-01 2019-06-30
12.x No LTS 2019-10-22 2021-04-01 2022-04-01
add a comment |
Node.js is available as a snap package in all currently supported versions of Ubuntu. Specific to Node.js, developers can choose from one of the currently supported releases and get regular automatic updates directly from NodeSource. Node.js versions 6, 8, 9, 10, 11 and 12 are currently available, with the Snap Store being updated within hours, or minutes of a Node.js release.
Node can be installed with a single command, for example:
sudo snap install node --classic --channel 11/stable
The node snap can be accessed by the command node
, for example:
$ node -v
v11.5.0
An up-to-date version of npm will installed as part of the node snap. npm should be run outside of the node repl, in your normal shell. After installing the node snap run the following command to enable npm update checking:
sudo chown -R $USER:$(id -gn $USER) /home/your-username/.config
Replace your-username
in the above command with your own username. Then run npm -v
to check if the version of npm is up-to-date. As an example I checked that npm was up-to-date, checked the version of an already installed package named yarn with the command npm list yarn
and then updated the existing yarn package to the latest version with the command npm update yarn
Users can switch between versions of Node.js at any time without needing to involve additional tools like nvm (Node Version Manager), for example:
sudo snap refresh node --channel=11/stable
Users can test bleeding-edge versions of Node.js that can be installed from the latest edge channel which is currently tracking Node.js version 12 by switching with:
sudo snap switch node --edge
This approach is only recommended for those users who are willing to participate in testing and bug reporting upstream.
Node.js LTS Schedule
Release LTS Status Codename LTS Start Maintenance Start Maintenance End
6.x Active Boron 2016-10-18 April 2018 April 2019
7.x No LTS
8.x Active Carbon 2017-10-31 April 2019 December 2019
9.x No LTS
10.x Active Dubnium October 2018 April 2020 April 2021
11.x No LTS 2019-04-01 2019-06-30
12.x No LTS 2019-10-22 2021-04-01 2022-04-01
add a comment |
Node.js is available as a snap package in all currently supported versions of Ubuntu. Specific to Node.js, developers can choose from one of the currently supported releases and get regular automatic updates directly from NodeSource. Node.js versions 6, 8, 9, 10, 11 and 12 are currently available, with the Snap Store being updated within hours, or minutes of a Node.js release.
Node can be installed with a single command, for example:
sudo snap install node --classic --channel 11/stable
The node snap can be accessed by the command node
, for example:
$ node -v
v11.5.0
An up-to-date version of npm will installed as part of the node snap. npm should be run outside of the node repl, in your normal shell. After installing the node snap run the following command to enable npm update checking:
sudo chown -R $USER:$(id -gn $USER) /home/your-username/.config
Replace your-username
in the above command with your own username. Then run npm -v
to check if the version of npm is up-to-date. As an example I checked that npm was up-to-date, checked the version of an already installed package named yarn with the command npm list yarn
and then updated the existing yarn package to the latest version with the command npm update yarn
Users can switch between versions of Node.js at any time without needing to involve additional tools like nvm (Node Version Manager), for example:
sudo snap refresh node --channel=11/stable
Users can test bleeding-edge versions of Node.js that can be installed from the latest edge channel which is currently tracking Node.js version 12 by switching with:
sudo snap switch node --edge
This approach is only recommended for those users who are willing to participate in testing and bug reporting upstream.
Node.js LTS Schedule
Release LTS Status Codename LTS Start Maintenance Start Maintenance End
6.x Active Boron 2016-10-18 April 2018 April 2019
7.x No LTS
8.x Active Carbon 2017-10-31 April 2019 December 2019
9.x No LTS
10.x Active Dubnium October 2018 April 2020 April 2021
11.x No LTS 2019-04-01 2019-06-30
12.x No LTS 2019-10-22 2021-04-01 2022-04-01
Node.js is available as a snap package in all currently supported versions of Ubuntu. Specific to Node.js, developers can choose from one of the currently supported releases and get regular automatic updates directly from NodeSource. Node.js versions 6, 8, 9, 10, 11 and 12 are currently available, with the Snap Store being updated within hours, or minutes of a Node.js release.
Node can be installed with a single command, for example:
sudo snap install node --classic --channel 11/stable
The node snap can be accessed by the command node
, for example:
$ node -v
v11.5.0
An up-to-date version of npm will installed as part of the node snap. npm should be run outside of the node repl, in your normal shell. After installing the node snap run the following command to enable npm update checking:
sudo chown -R $USER:$(id -gn $USER) /home/your-username/.config
Replace your-username
in the above command with your own username. Then run npm -v
to check if the version of npm is up-to-date. As an example I checked that npm was up-to-date, checked the version of an already installed package named yarn with the command npm list yarn
and then updated the existing yarn package to the latest version with the command npm update yarn
Users can switch between versions of Node.js at any time without needing to involve additional tools like nvm (Node Version Manager), for example:
sudo snap refresh node --channel=11/stable
Users can test bleeding-edge versions of Node.js that can be installed from the latest edge channel which is currently tracking Node.js version 12 by switching with:
sudo snap switch node --edge
This approach is only recommended for those users who are willing to participate in testing and bug reporting upstream.
Node.js LTS Schedule
Release LTS Status Codename LTS Start Maintenance Start Maintenance End
6.x Active Boron 2016-10-18 April 2018 April 2019
7.x No LTS
8.x Active Carbon 2017-10-31 April 2019 December 2019
9.x No LTS
10.x Active Dubnium October 2018 April 2020 April 2021
11.x No LTS 2019-04-01 2019-06-30
12.x No LTS 2019-10-22 2021-04-01 2022-04-01
edited Dec 27 '18 at 9:07
answered Mar 9 '15 at 15:25
karelkarel
60.6k13132155
60.6k13132155
add a comment |
add a comment |
For Ubuntu 15.10 you can download the .deb package form packages.ubuntu.com
node --version
v4.2.3
add a comment |
For Ubuntu 15.10 you can download the .deb package form packages.ubuntu.com
node --version
v4.2.3
add a comment |
For Ubuntu 15.10 you can download the .deb package form packages.ubuntu.com
node --version
v4.2.3
For Ubuntu 15.10 you can download the .deb package form packages.ubuntu.com
node --version
v4.2.3
edited Dec 23 '15 at 20:20
Jakuje
5,32471831
5,32471831
answered Dec 23 '15 at 18:38
Beinhart GschichtldruckerBeinhart Gschichtldrucker
311
311
add a comment |
add a comment |
Just a spin-off of the answer by @23W (accepted answer).
This is just the contents of the script, just to avoid doing curl to root shell.
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
echo "deb https://deb.nodesource.com/node_6.x $(lsb_release -c -s) main" | sudo tee /etc/apt/sources.list.d/nodesource.list
echo "deb-src https://deb.nodesource.com/node_6.x $(lsb_release -c -s) main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install -y nodejs
add a comment |
Just a spin-off of the answer by @23W (accepted answer).
This is just the contents of the script, just to avoid doing curl to root shell.
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
echo "deb https://deb.nodesource.com/node_6.x $(lsb_release -c -s) main" | sudo tee /etc/apt/sources.list.d/nodesource.list
echo "deb-src https://deb.nodesource.com/node_6.x $(lsb_release -c -s) main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install -y nodejs
add a comment |
Just a spin-off of the answer by @23W (accepted answer).
This is just the contents of the script, just to avoid doing curl to root shell.
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
echo "deb https://deb.nodesource.com/node_6.x $(lsb_release -c -s) main" | sudo tee /etc/apt/sources.list.d/nodesource.list
echo "deb-src https://deb.nodesource.com/node_6.x $(lsb_release -c -s) main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install -y nodejs
Just a spin-off of the answer by @23W (accepted answer).
This is just the contents of the script, just to avoid doing curl to root shell.
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
echo "deb https://deb.nodesource.com/node_6.x $(lsb_release -c -s) main" | sudo tee /etc/apt/sources.list.d/nodesource.list
echo "deb-src https://deb.nodesource.com/node_6.x $(lsb_release -c -s) main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install -y nodejs
answered Aug 3 '16 at 16:56
ATOzTOAATOzTOA
30037
30037
add a comment |
add a comment |
Download nodejs
from https://nodejs.org/
To install from a terminal:
cd /usr/local
tar --strip-components 1 -xJf ~/Downloads/node-v4.4.5-linux-x64.tar.xz
add a comment |
Download nodejs
from https://nodejs.org/
To install from a terminal:
cd /usr/local
tar --strip-components 1 -xJf ~/Downloads/node-v4.4.5-linux-x64.tar.xz
add a comment |
Download nodejs
from https://nodejs.org/
To install from a terminal:
cd /usr/local
tar --strip-components 1 -xJf ~/Downloads/node-v4.4.5-linux-x64.tar.xz
Download nodejs
from https://nodejs.org/
To install from a terminal:
cd /usr/local
tar --strip-components 1 -xJf ~/Downloads/node-v4.4.5-linux-x64.tar.xz
edited Aug 18 '16 at 7:09
user308164
answered Aug 15 '16 at 16:21
rodrigogbgodrodrigogbgod
311
311
add a comment |
add a comment |
//Download
cd ~/Downloads
wget https://nodejs.org/dist/v4.4.5/node-v4.4.5-linux-x64.tar.xz
//Install
cd /usr/local
tar --strip-components 1 -xJf ~/Downloads/node-v4.4.5-linux-x64.tar.xz
//Verify
node -v
npm version
Source
add a comment |
//Download
cd ~/Downloads
wget https://nodejs.org/dist/v4.4.5/node-v4.4.5-linux-x64.tar.xz
//Install
cd /usr/local
tar --strip-components 1 -xJf ~/Downloads/node-v4.4.5-linux-x64.tar.xz
//Verify
node -v
npm version
Source
add a comment |
//Download
cd ~/Downloads
wget https://nodejs.org/dist/v4.4.5/node-v4.4.5-linux-x64.tar.xz
//Install
cd /usr/local
tar --strip-components 1 -xJf ~/Downloads/node-v4.4.5-linux-x64.tar.xz
//Verify
node -v
npm version
Source
//Download
cd ~/Downloads
wget https://nodejs.org/dist/v4.4.5/node-v4.4.5-linux-x64.tar.xz
//Install
cd /usr/local
tar --strip-components 1 -xJf ~/Downloads/node-v4.4.5-linux-x64.tar.xz
//Verify
node -v
npm version
Source
edited Jun 1 '16 at 8:18
answered Jun 1 '16 at 8:11
Sergey RepinSergey Repin
1212
1212
add a comment |
add a comment |
My favorite way to install latest nodejs and npm is using the installation binaries archive provided on nodejs' website.
This might quickly become your new favorite way too. Works like a charm. It involves 1 download and 1 command. Done. NO errors [the multiple times I've done this]. Didn't need to uninstall existing stuff beforehand.
Installing nodejs via Binaries
At first remove the installed version: (if exists)
sudo apt-get remove nodejs
Download
https://nodejs.org/en/download/stable/
Download Linux Binaries.
- I had to extract the tar.xz to a folder and then re-compress as tar.gz
Install
sudo tar -C /usr/local --strip-components 1 -xzf /path/to/downloaded/tar/node-vYOURVERSION-linux-x64.tar.gz
Verify
node -v
npm --version
Source
http://www.thegeekstuff.com/2015/10/install-nodejs-npm-linux/
1
Why re-compress as tar.gz?tar
supports--xz
- and-C /usr/local
to lettar
do thecd
for you.
– muru
Apr 14 '16 at 22:28
add a comment |
My favorite way to install latest nodejs and npm is using the installation binaries archive provided on nodejs' website.
This might quickly become your new favorite way too. Works like a charm. It involves 1 download and 1 command. Done. NO errors [the multiple times I've done this]. Didn't need to uninstall existing stuff beforehand.
Installing nodejs via Binaries
At first remove the installed version: (if exists)
sudo apt-get remove nodejs
Download
https://nodejs.org/en/download/stable/
Download Linux Binaries.
- I had to extract the tar.xz to a folder and then re-compress as tar.gz
Install
sudo tar -C /usr/local --strip-components 1 -xzf /path/to/downloaded/tar/node-vYOURVERSION-linux-x64.tar.gz
Verify
node -v
npm --version
Source
http://www.thegeekstuff.com/2015/10/install-nodejs-npm-linux/
1
Why re-compress as tar.gz?tar
supports--xz
- and-C /usr/local
to lettar
do thecd
for you.
– muru
Apr 14 '16 at 22:28
add a comment |
My favorite way to install latest nodejs and npm is using the installation binaries archive provided on nodejs' website.
This might quickly become your new favorite way too. Works like a charm. It involves 1 download and 1 command. Done. NO errors [the multiple times I've done this]. Didn't need to uninstall existing stuff beforehand.
Installing nodejs via Binaries
At first remove the installed version: (if exists)
sudo apt-get remove nodejs
Download
https://nodejs.org/en/download/stable/
Download Linux Binaries.
- I had to extract the tar.xz to a folder and then re-compress as tar.gz
Install
sudo tar -C /usr/local --strip-components 1 -xzf /path/to/downloaded/tar/node-vYOURVERSION-linux-x64.tar.gz
Verify
node -v
npm --version
Source
http://www.thegeekstuff.com/2015/10/install-nodejs-npm-linux/
My favorite way to install latest nodejs and npm is using the installation binaries archive provided on nodejs' website.
This might quickly become your new favorite way too. Works like a charm. It involves 1 download and 1 command. Done. NO errors [the multiple times I've done this]. Didn't need to uninstall existing stuff beforehand.
Installing nodejs via Binaries
At first remove the installed version: (if exists)
sudo apt-get remove nodejs
Download
https://nodejs.org/en/download/stable/
Download Linux Binaries.
- I had to extract the tar.xz to a folder and then re-compress as tar.gz
Install
sudo tar -C /usr/local --strip-components 1 -xzf /path/to/downloaded/tar/node-vYOURVERSION-linux-x64.tar.gz
Verify
node -v
npm --version
Source
http://www.thegeekstuff.com/2015/10/install-nodejs-npm-linux/
edited Jun 13 '17 at 7:14
muru
1
1
answered Apr 14 '16 at 22:09
amurrellamurrell
1213
1213
1
Why re-compress as tar.gz?tar
supports--xz
- and-C /usr/local
to lettar
do thecd
for you.
– muru
Apr 14 '16 at 22:28
add a comment |
1
Why re-compress as tar.gz?tar
supports--xz
- and-C /usr/local
to lettar
do thecd
for you.
– muru
Apr 14 '16 at 22:28
1
1
Why re-compress as tar.gz?
tar
supports --xz
- and -C /usr/local
to let tar
do the cd
for you.– muru
Apr 14 '16 at 22:28
Why re-compress as tar.gz?
tar
supports --xz
- and -C /usr/local
to let tar
do the cd
for you.– muru
Apr 14 '16 at 22:28
add a comment |
Video Explanation
NVM is very simple to install and allows you to easily switch node versions. From the github repository:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
downloads and runs the installation script
nvm ls-remote
to see the available versions. Say you want to install version 8.9.4
nvm install 8.9.4
and you're done.
To install another version and use it (say 9.6.1)
nvm install 9.6.1
nvm alias default 9.6.1
add a comment |
Video Explanation
NVM is very simple to install and allows you to easily switch node versions. From the github repository:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
downloads and runs the installation script
nvm ls-remote
to see the available versions. Say you want to install version 8.9.4
nvm install 8.9.4
and you're done.
To install another version and use it (say 9.6.1)
nvm install 9.6.1
nvm alias default 9.6.1
add a comment |
Video Explanation
NVM is very simple to install and allows you to easily switch node versions. From the github repository:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
downloads and runs the installation script
nvm ls-remote
to see the available versions. Say you want to install version 8.9.4
nvm install 8.9.4
and you're done.
To install another version and use it (say 9.6.1)
nvm install 9.6.1
nvm alias default 9.6.1
Video Explanation
NVM is very simple to install and allows you to easily switch node versions. From the github repository:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
downloads and runs the installation script
nvm ls-remote
to see the available versions. Say you want to install version 8.9.4
nvm install 8.9.4
and you're done.
To install another version and use it (say 9.6.1)
nvm install 9.6.1
nvm alias default 9.6.1
answered Feb 25 '18 at 7:11
Mina MichaelMina Michael
4,2121860122
4,2121860122
add a comment |
add a comment |
This approach allows you easily delete Node.JS, keep different versions and provide the commands to all the system users.
Download the stable version of Node.JS, uncompress it, and move it into /opt
.
In case you wish to install different versions, you can rename the folder according to its version code:
/opt/node/6.9.1
Since only root can change files in /opt
/, if you don't wish to call invoke sudo
every time you need to modify a file, change the group permission:
chgrp adm -R /opt/node/6.9.1
Then create file /etc/profile.d/node.sh
if the following content:
export NODE_ENV=/opt/node/6.9.1
export CPLUS_INCLUDE_PATH=${NODE_ENV}/include
export C_INCLUDE_PATH=${NODE_ENV}/include
export LD_LIBRARY_PATH=${NODE_ENV}/lib
export MANPATH=${NODE_ENV}/share/man:${MANPATH}
export PATH=${NODE_ENV}/bin:$PATH
Logout and login and X-Window will reload all profile configurations.
If you had a previous versions installed, to avoid library conflicts run:
npm cache clean
add a comment |
This approach allows you easily delete Node.JS, keep different versions and provide the commands to all the system users.
Download the stable version of Node.JS, uncompress it, and move it into /opt
.
In case you wish to install different versions, you can rename the folder according to its version code:
/opt/node/6.9.1
Since only root can change files in /opt
/, if you don't wish to call invoke sudo
every time you need to modify a file, change the group permission:
chgrp adm -R /opt/node/6.9.1
Then create file /etc/profile.d/node.sh
if the following content:
export NODE_ENV=/opt/node/6.9.1
export CPLUS_INCLUDE_PATH=${NODE_ENV}/include
export C_INCLUDE_PATH=${NODE_ENV}/include
export LD_LIBRARY_PATH=${NODE_ENV}/lib
export MANPATH=${NODE_ENV}/share/man:${MANPATH}
export PATH=${NODE_ENV}/bin:$PATH
Logout and login and X-Window will reload all profile configurations.
If you had a previous versions installed, to avoid library conflicts run:
npm cache clean
add a comment |
This approach allows you easily delete Node.JS, keep different versions and provide the commands to all the system users.
Download the stable version of Node.JS, uncompress it, and move it into /opt
.
In case you wish to install different versions, you can rename the folder according to its version code:
/opt/node/6.9.1
Since only root can change files in /opt
/, if you don't wish to call invoke sudo
every time you need to modify a file, change the group permission:
chgrp adm -R /opt/node/6.9.1
Then create file /etc/profile.d/node.sh
if the following content:
export NODE_ENV=/opt/node/6.9.1
export CPLUS_INCLUDE_PATH=${NODE_ENV}/include
export C_INCLUDE_PATH=${NODE_ENV}/include
export LD_LIBRARY_PATH=${NODE_ENV}/lib
export MANPATH=${NODE_ENV}/share/man:${MANPATH}
export PATH=${NODE_ENV}/bin:$PATH
Logout and login and X-Window will reload all profile configurations.
If you had a previous versions installed, to avoid library conflicts run:
npm cache clean
This approach allows you easily delete Node.JS, keep different versions and provide the commands to all the system users.
Download the stable version of Node.JS, uncompress it, and move it into /opt
.
In case you wish to install different versions, you can rename the folder according to its version code:
/opt/node/6.9.1
Since only root can change files in /opt
/, if you don't wish to call invoke sudo
every time you need to modify a file, change the group permission:
chgrp adm -R /opt/node/6.9.1
Then create file /etc/profile.d/node.sh
if the following content:
export NODE_ENV=/opt/node/6.9.1
export CPLUS_INCLUDE_PATH=${NODE_ENV}/include
export C_INCLUDE_PATH=${NODE_ENV}/include
export LD_LIBRARY_PATH=${NODE_ENV}/lib
export MANPATH=${NODE_ENV}/share/man:${MANPATH}
export PATH=${NODE_ENV}/bin:$PATH
Logout and login and X-Window will reload all profile configurations.
If you had a previous versions installed, to avoid library conflicts run:
npm cache clean
edited Dec 10 '16 at 13:59
answered Nov 18 '16 at 21:55
JP VenturaJP Ventura
1266
1266
add a comment |
add a comment |
Update Package Manager
sudo apt-get update
Adding NodeJS PPAs
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
Installing NodeJS and NPM
sudo apt-get install nodejs
Here, I Wrote a Complete Blog post about Installing NodeJS and NPM in Ubuntu.
Click Here to Read
Curling into a root shell is a really bad thing to do in general do to the huge number of security issues this opens up, I would recommend that you update your blog post and your answer to not do this.
– shuttle87
Jul 13 '18 at 11:35
add a comment |
Update Package Manager
sudo apt-get update
Adding NodeJS PPAs
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
Installing NodeJS and NPM
sudo apt-get install nodejs
Here, I Wrote a Complete Blog post about Installing NodeJS and NPM in Ubuntu.
Click Here to Read
Curling into a root shell is a really bad thing to do in general do to the huge number of security issues this opens up, I would recommend that you update your blog post and your answer to not do this.
– shuttle87
Jul 13 '18 at 11:35
add a comment |
Update Package Manager
sudo apt-get update
Adding NodeJS PPAs
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
Installing NodeJS and NPM
sudo apt-get install nodejs
Here, I Wrote a Complete Blog post about Installing NodeJS and NPM in Ubuntu.
Click Here to Read
Update Package Manager
sudo apt-get update
Adding NodeJS PPAs
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
Installing NodeJS and NPM
sudo apt-get install nodejs
Here, I Wrote a Complete Blog post about Installing NodeJS and NPM in Ubuntu.
Click Here to Read
answered Jun 5 '17 at 11:58
MC NaveenMC Naveen
16715
16715
Curling into a root shell is a really bad thing to do in general do to the huge number of security issues this opens up, I would recommend that you update your blog post and your answer to not do this.
– shuttle87
Jul 13 '18 at 11:35
add a comment |
Curling into a root shell is a really bad thing to do in general do to the huge number of security issues this opens up, I would recommend that you update your blog post and your answer to not do this.
– shuttle87
Jul 13 '18 at 11:35
Curling into a root shell is a really bad thing to do in general do to the huge number of security issues this opens up, I would recommend that you update your blog post and your answer to not do this.
– shuttle87
Jul 13 '18 at 11:35
Curling into a root shell is a really bad thing to do in general do to the huge number of security issues this opens up, I would recommend that you update your blog post and your answer to not do this.
– shuttle87
Jul 13 '18 at 11:35
add a comment |
Updating Package Manager
sudo apt-get update
Adding PPA
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
Installing NodeJS and NPM
sudo apt-get install nodejs
For Reference : Installing NodeJS in Ubuntu - WebCheerz
add a comment |
Updating Package Manager
sudo apt-get update
Adding PPA
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
Installing NodeJS and NPM
sudo apt-get install nodejs
For Reference : Installing NodeJS in Ubuntu - WebCheerz
add a comment |
Updating Package Manager
sudo apt-get update
Adding PPA
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
Installing NodeJS and NPM
sudo apt-get install nodejs
For Reference : Installing NodeJS in Ubuntu - WebCheerz
Updating Package Manager
sudo apt-get update
Adding PPA
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
Installing NodeJS and NPM
sudo apt-get install nodejs
For Reference : Installing NodeJS in Ubuntu - WebCheerz
answered Jun 3 '17 at 20:44
MC NaveenMC Naveen
16715
16715
add a comment |
add a comment |
protected by Community♦ Nov 29 '16 at 18:58
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
1
What's wrong with
sudo apt-get install nodejs
?– AlikElzin-kilaka
Apr 4 '16 at 7:29
20
^ it installs 1.10.0.
– siliconrockstar
May 7 '16 at 3:10
6
@siliconrockstar that actually installed v0.10.25 on my 14.04 LTS
– Alessandro Cosentino
Jan 3 '17 at 17:00
1
In ubuntu 16 use
sudo apt-get install nodejs-legacy
– briankip
Apr 5 '17 at 9:45