Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install npm on debian vagrant box? [closed]

How can I install npm inside Debian vagrant box? I try this, but it's not wotking.

vagrant@packer-debian-7:~$ sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 82 not upgraded.
vagrant@packer-debian-7:~$ nodejs -v
v0.10.29
vagrant@packer-debian-7:~$ sudo apt-get install npm
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package npm
vagrant@packer-debian-7:~$ npm -v
-bash: npm: command not found

My host OS is Ubuntu

like image 529
Pac Rauce Avatar asked Oct 29 '15 14:10

Pac Rauce


2 Answers

The debian way would be to add the repo and install with apt-get

curl --silent --location https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get update
sudo apt-get install --yes nodejs

That will install nodejs and npm the debian way

Here you have a vagrant provision i build that comes with nodejs https://github.com/Sudakatux/vagrant-liferay-others

like image 151
jstuartmilne Avatar answered Sep 30 '22 12:09

jstuartmilne


run command :

wget https://npmjs.org/install.sh 
sudo chmod +x install.sh
sudo ./install.sh

it will install npm to your vagrant box.

like image 39
pl_rock Avatar answered Sep 30 '22 11:09

pl_rock