Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Node.js on Ubuntu

I'm trying install Node.js on Ubuntu 12.10 (Quantal Quetzal), 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 it 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.

like image 243
David Aguilar Avatar asked Oct 09 '22 23:10

David Aguilar


People also ask

CAN NodeJS run on Ubuntu?

Node. js is based on the v8 JavaScript engine of Chrome and can be easily installed on various operating systems such as Windows, macOS, and Linux-based systems e.g. Ubuntu.

Can I install Node with npm?

Using a Node version manager to install Node. js and npm. Node version managers allow you to install and switch between multiple versions of Node. js and npm on your system so you can test your applications on multiple versions of npm to ensure they work for users on different versions.


1 Answers

Simply follow the instructions given here:

Example install:

sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

It installs current stable Node on the current stable Ubuntu. Quantal (12.10) users may need to install the software-properties-common package for the add-apt-repository command to work: sudo apt-get install software-properties-common

As of Node.js v0.10.0, the nodejs package from Chris Lea's repo includes both npm and nodejs-dev.

Don't give sudo apt-get install nodejs npm. Just sudo apt-get install nodejs.

like image 477
user568109 Avatar answered Oct 11 '22 13:10

user568109