I'm trying install Node.js on my ubuntu 12.10, but the terminal show me an error about lost packages, I was trying 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 the last line sudo apt-get install nodejs npm show me an 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 in last version but also show 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.
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 nodejsIt 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-repositorycommand to work:sudo apt-get install software-properties-commonAs 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
As of today, you can simply install it with:
sudo apt-get install nodejs
npm is automatically installed with node.js in the latest version of node. What do you see when you type node --version and npm --version in the terminal?
You can upgrade npm using npm itself as well
[sudo] npm install -g npm
My 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
This is the best way to easy install NODE.JS. This also is actual for Ubuntu 12.04, 13.04 and 14.04
Adding node js repositories
[sudo] apt-get install python-software-properties
[sudo] apt-add-repository ppa:chris-lea/node.js
[sudo] apt-get update
node.js installation
[sudo] apt-get install nodejs
Now checking node.js version
node -v
Outputs
v0.10.20
This command should install npm.
npm install
Check npm version
npm -v
Outputs
1.4.3
If for some reason, if you see npm is not installed, you may try running:
[sudo] apt-get install npm
To update npm you may try running:
[sudo] npm install -g npm
You can use nvm to install nodejs. It allows you work with different versions without conflicts.
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.19.0/install.sh | bash
nvm install v0.10.33
just use nvm for node version control nvm
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
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install
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)).