1

I am having trouble understanding how I would get node.js, Grunt and NPM to run on my Vagrant box. I am using the ubuntu-precise12042-x64-vbox43 and provisioning it through puppet. I am just getting started with puppet so I went to https://puphpet.com to generate a manifest. After vagrant up the box provisioned as it should and all is up and running without a problem. I then google around to find https://stackoverflow.com/questions/19000534/install-node-js-on-ubuntu-12-04-lts-using-puppet. I ran vagrant SSH and after that I ran puppet module install willdurand/nodejs which ran fine. Now is the problem that I don´t know what to do next? I thought I would be able to run NPM and Node commands while "in" vagrant SSH. What am i doing wrong? If I run just NPMit says:

the program 'npm' is currently not installed. You can install it by typing: sudo apt-get install npm

Do I have to run some other command?

2 Answers 2

0

Just installing the puppet module doesn't install the program, it just tells puppet how to deal with nodejs in puppet. You need to add a declaration to your puppet manifest and run vagrant provision again.

Example:

class { 'nodejs':
  version => 'stable',
}

package { 'express':
  provider => npm
}
0

In Vagrantfile define your provisioning file:

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

Then create package.json for npm with required packages (e.g. grunt) like:

{
  "name": "vagrant",
  "devDependencies": {
    "grunt": "~0.4.5",
    "grunt-cli": "^0.1.13",
    "grunt-exec": "^0.4.6",
    "shelljs": "^0.5.3"
  }
}

Then in provision.sh install npm and dependent packages via:

apt-get install
npm install
grunt --version

and see if that would work during the VM provisioning (vagrant up).

Or use the Puppet manifest as described in the other answer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .