Install Node.js on Ubuntu
As of today, you can simply install it with:
sudo apt-get install nodejs
I'm trying install Node.js on Ubuntu 12.10, but the terminal shows me an error about lost packages. I tried with this:
sudo apt-get install python-software-properties sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install nodejs npm
But when I came to the last line
sudo apt-get install nodejs npm shows this error:
Failed to install some packages. This may mean that you requested an impossible situation or if you are using the distribution distribution that some required packages have not yet been created or been been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: nodejs: Conflicts: npm E: Failed to correct problems, you have held broken packages.
Then I uninstalled the
ppa:chris-lea/node.js and I was trying a second option:
sudo apt-get install node.js sudo apt-add-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install nodejs npm
The same error, the terminal says
npm is the latest version but also shows me the text I shown in the top. I think the problem is
ppa:chris-lea/node.js but I don't know how solve it.
I personally do it this way:
sudo apt-get install python g++ make wget http://nodejs.org/dist/node-latest.tar.gz tar xvfvz node-latest.tar.gz cd node-v0.12.0 ./configure make sudo make install
If you want to install particular version than download the version you want from nodejs site and execute the last tree steps.
I would strongly suggest not using the default nodejs package from the distro market because it would be probably outdated. (i.e. the current for the time of writing this in the ubuntu market is v0.10.25 which is too outdated compared to the latest (v0.12.0)).
You can use nvm to install nodejs. It allows you work with different versions without conflicts.
apt-get was old and busted, so I had to install from source. Here is what worked for me:
# get the latest version from nodejs.org. At the time of this writing, it was 0.10.24 curl -o ~/node.tar.gz http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz cd tar -zxvf node.tar.gz cd node-v0.6.18 ./configure && make && sudo make install
These steps were mostly taken from joyent's installation wiki
Follow the instructions given here at NodeSource which is dedicated to creating a sustainable ecosystem for Node.js
For Node.js >= 4.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
You can also compile it from source like this
git clone git://github.com/ry/node.git cd node ./configure make sudo make install
Find detailed instructions here http://howtonode.org/how-to-install-nodejs
Install Node.js on Ubuntu
14.04 LTS or
Please avoid to install
Ubuntu. If you already installed Node.js with the built in package manager, please remove that. (
sudo apt-get purge nodejs && sudo apt-get autoremove && sudo apt-get autoclean)
The installation process on Linux is the same as on
With the provided script:
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash $ nvm list $ nvm ls-remote $ nvm install 6.4.0 $ nvm use 6.4.0 $ nvm alias default 6.4.0 $ node -v $ npm install -g npm $ npm -v
One more thing! Don’t forget to run the following command, which increases the amount of inotify watches.
$ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Hope this help you!