npm install fails on a vagrant VM with debian 7.8 and postgres 9.3

343 views Asked by At

I need to reproduce a production node environment with specific (old) versions, on my local mac machine using vagrant, and when i run npm install it always fails with errors as follow:

  • optional dep failed continuing [email protected]
  • optional dep failed, continuing [email protected]
  • optional dep failed, continuing imagemin-xx
  • EEXIST, open '/root/.npm/0ae333bd-t-npm-inherits-2-0-1-package-tgz.lock'
    File exists: /root/.npm/0ae333bd-t-npm-inherits-2-0-1-package-tgz.lock Move it away, and try again.

I have tried many things without success:

  • npm install --no-bin-links
  • sudo npm install
  • npm cache clean
  • rm -r node_modules
  • rm -r /root/.npm/

I could not figure out what I am doing wrong and what's the cause...

Any idea about what I am doing wrong or some suggestions would be welcome. Thanks.

Here is my env details:

  • OS: Debian 7.8
  • node: v0.10.36
  • npm: 1.4.28
  • PostgreSql : 9.3.6
  • PostGis: 2.1
  • git:1.7.10.4
  • ruby: 1.9.3

I have 2 directories in my vagrant project:

  • www: containes my app
  • config: containes packages list and db dump

My vagrant file:

Vagrant.configure(2) do |config|
    config.vm.box = "puppetlabs/debian-7.8-64-puppet"
    config.vm.hostname = "ppld-preprod"
    config.vm.provision "shell", path: "provision.sh"

    config.vm.network "forwarded_port", guest: 80, host: 8999

    config.vm.synced_folder "./", "/vagrant", disabled: true
    config.vm.synced_folder "www", "/vagrant/www"
    config.vm.synced_folder "config", "/vagrant/config"
end 

My provision file:

apt-get -y update

dpkg --set-selections < /config/packages_list
apt-get -y -u dselect-upgrade

wget http://nodejs.org/dist/v0.10.36/node-v0.10.36.tar.gz
tar xfz node-v0.10.36.tar.gz
cd node-v0.10.36
./configure
make    

make install

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

sudo apt-get -y install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

apt-get -y update

sudo apt-get -y install postgresql-9.3-postgis-2.1
sudo apt-get -y install postgresql-server-dev-9.3

sudo apt-get -y install git

sudo chown -R $(whoami) "/vagrant/"
sudo chmod -R 777 /vagrant/

cd /vagrant/www/ppld/
sudo npm install
1

There are 1 answers

4
Pierre Inglebert On

Your issue is really strange, can you update your npm to version 2+ ?

npm update -g npm