Seem to be having A LOT of trouble figuring this one out, but I'm attempting to use vagrant and provision a server that uses node / npm to install dependencies. My setup is:

  • ubuntu 12.04 host (old dev environment)
  • ubuntu 12.04 guest (created via vagrant)
  • using shell provisioner to setup my server (php 5.3, apache, mysql)
  • all is good, everything installs, UNTIL I get to the npm install command

In my case, npm install seems to install everything (lots of terminal output, etc...). The next line in the provisioning script does grunt someTask to which I get "grunt command not found". So even though npm install appeared to install everything in reality it didn't.

In researching, it seems to be an issue with virtualbox and symlinks in a shared folder. I've added:

config.vm.provider "virtualbox" do |vb|
  # Use VBoxManage to customize the VM. For example to change memory:
  vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
  vb.customize ["modifyvm", :id, "--memory", "1024"]


which seems to have no effect. I also attempted install with the --no-bin-links flag, again, seems to have no effect. Any ideas how I can get npm to install my project dependencies properly? Thanks so much for any input.


This gist, https://gist.github.com/anonymous/b760fdfa9c204c24424b is the output I get when I run vagrant up. As you can see it appears as if everything is installing, yet, when I ssh into the box, or even from the provisioning script, I can not run "grunt" as it says it's not installed. There is a node_modules in my repo after the npm install --no-bin-links is complete.


You need to install grunt as it seems it is not being installed by your provisioning script.

To install it globally run this command:

npm install -g grunt-cli

You can either run it manually or add it to your provisioning script.

  • grunt is listed as a dependency in my package.json file. When running npm install this should be installed, yes? Also it works fine when I just npm install on my local machine, so I know the package.json file is configured properly. – Greg Apr 14 '14 at 15:05
  • but if grunt was installed correctly you shouldn't get grunt command not found. Maybe it install non-cli version via package.json, but the deployment script expects global grunt (note the -g flag in npm install). It would also make sense why it is working in your local environment - I would guess you also have grunt installed globally there. – phoops Apr 14 '14 at 15:24
  • 1
    Hmm, just realized there is a difference between grunt and grunt-cli. It seems I can't install grunt-cli via package.json, so I moved that inline in the provisioning script, and then run npm install to install all the other dependencies. It works! – Greg Apr 14 '14 at 20:18
  • Glad you got it sorted. – phoops Apr 14 '14 at 20:40

Are you used the right repository to install NPM?

apt-add-repository ppa:chris-lea/node.js
apt-get update
apt-get install -y nodejs

I used to install nodejs without this repository and got a lot of troubles, with this repository i can use NPM install free of errors in my Vagrant Virtual Box Using Ubuntu 12.04, try it.

  • Hi, thanks for the response. Yes, I'm using that PPA for node. That section of my provisioning script looks like: #install node add-apt-repository -y ppa:chris-lea/node.js apt-get update apt-get install python g++ make nodejs – Greg Apr 14 '14 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.