0

I am trying to setup dev environment on vagrantbox.
My host environment is:

  • windows 7
  • Vagrant version 1.8.1
  • Vbox version 5.0.20r106931

Here is my Vagrant file:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|

  config.vm.box = "hashicorp/precise64"
  config.vm.hostname = "frontend"

  config.vm.provision "shell", path: "provision.sh"

  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true

    # Customize the amount of memory on the VM:
    vb.memory = "4096"
    vb.cpus = "2"
  end

end

and here is my vagrant provisioning file:

apt-get -y update
apt-get -y install curl
apt-get -y install git
apt-get -y install nodejs
apt-get -y install npm
apt-get -y install python-pip

After booting up vagrant and ssh-ing into it following command fails:

sudo npm install -g grunt

and here is error log from npm-debug.log file:

info it worked if it ends with ok
verbose cli [ 'node', '/usr/bin/npm', 'install', '-g', 'grunt' ]
info using npm@1.1.4
info using node@v0.6.12
verbose config file /home/vagrant/.npmrc
verbose config file /usr/etc/npmrc
verbose config file /usr/share/npm/npmrc
silly exec /usr/bin/node "/usr/share/npm/bin/npm-get-uid-gid.js" "nobody" 1000
silly spawning [ '/usr/bin/node',
silly spawning   [ '/usr/share/npm/bin/npm-get-uid-gid.js', 'nobody', 1000 ],
silly spawning   null ]
silly output from getuid/gid {"uid":65534,"gid":1000}
silly output from getuid/gid 
verbose cache add [ 'grunt', null ]
silly cache add: name, spec, args [ undefined, 'grunt', [ 'grunt', null ] ]
verbose parsed url { pathname: 'grunt', path: 'grunt', href: 'grunt' }
verbose addNamed [ 'grunt', '' ]
verbose addNamed [ null, '' ]
silly name, range, hasData [ 'grunt', '', false ]
verbose raw, before any munging grunt
verbose url resolving [ 'https://registry.npmjs.org/', './grunt' ]
verbose url resolved https://registry.npmjs.org/grunt
http GET https://registry.npmjs.org/grunt
ERR! Error: failed to fetch from registry: grunt
ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
ERR!     at Request.emit (events.js:88:20)
ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
ERR!     at ClientRequest.emit (events.js:67:17)
ERR!     at HTTPParser.onIncoming (http.js:1261:11)
ERR!     at HTTPParser.onHeadersComplete (http.js:102:31)
ERR! You may report this log at:
ERR!     <http://bugs.debian.org/npm>
ERR! or use
ERR!     reportbug --attach /vagrant/code/npm-debug.log npm
ERR! 
ERR! System Linux 3.2.0-23-generic
ERR! command "node" "/usr/bin/npm" "install" "-g" "grunt"
ERR! cwd /vagrant/code
ERR! node -v v0.6.12
ERR! npm -v 1.1.4
ERR! message failed to fetch from registry: grunt
verbose exit [ 1, true ]
gandra404
  • 5,727
  • 10
  • 52
  • 76

1 Answers1

1

even though precise is not yet end of life, you should use an more recent ubuntu release - up date your box with wily or xenial and the repo will be up to date

you have

info using npm@1.1.4
info using node@v0.6.12

but Grunt require Node > 0.8

so :

  1. update your box and use a recent release
  2. upgrade the versions of node / nom within your current box
Frederic Henri
  • 51,761
  • 10
  • 113
  • 139
  • This didn't solve the problem. This helps me to use latest ubuntu but error still persists. The real solution is on this link: https://github.com/npm/npm/issues/7308 – gandra404 May 17 '16 at 17:41
  • I will recheck againg if eventually permissions was a problem with thos solution later. IF works I wil laccpet this answer, if not I will give another answer(already working). Anyway I will use older version of vagrant due to fact that xenial impose some problems for my dev env .. check http://stackoverflow.com/questions/37283269/how-i-can-get-vagrant-folder-on-ubuntu-xenial64 – gandra404 May 17 '16 at 18:00
  • 1
    might have issue with symlink etc ... but stil grunt [requires stable Node.js version >= 0.8.0](http://gruntjs.com/getting-started) _ Odd version numbers of Node.js are considered unstable development versions._ so you might end up with a buggy installation – Frederic Henri May 18 '16 at 06:12