Hello. If I understand corrsctly, you want to run npm install from /vagrant.
If thats the case, then you need to have an scrip. say: provision.sh with a context like this: #!/bin/bash pushd /vagrant npm install And tell vagrant to run it with a provisioning line. config.vm.provision "shell", path: "provision.sh" Is that what you are after? Alvaro. On Sun, Feb 21, 2016 at 4:23 AM, valentin bancarel < [email protected]> wrote: > Hi there, I'm new to vagrant, but already love it !! I just configured a > MongoDB, nodejs server in no time. On vagrant up, I install node and mongo > via a bootstrap file, then my /vagrant folder is mount and synchronized, > that's perfect. But what I want now, after that done, is to run a command > ("npm install") from that directory to install node_modules given on a > package.json automatically synced from my host machine. > > I saw some option with the upstart event, and I think I'll be using that, > but I'm not a shell expert, and found this script on Github: > > #!upstart > description "Restart nginx after synced folders mounted" > author ".silent" > > start on vagrant-mounted > # Automatically restart process if crashed > respawn > # Essentially lets upstart know the process will detach itself to the > background > expect fork > # Run before process > pre-start script > end script > # Start the process > script > service nginx restart > end script > > I suppose I have to replace the 'service nginx restart' line by 'cd > /vagrant; npm installservice ' but I have no idea about what the others > commands are intended to, nor how to execute that script... So any help > would be really appreciate. Thanks > > -- > This mailing list is governed under the HashiCorp Community Guidelines - > https://www.hashicorp.com/community-guidelines.html. Behavior in > violation of those guidelines may result in your removal from this mailing > list. > > GitHub Issues: https://github.com/mitchellh/vagrant/issues > IRC: #vagrant on Freenode > --- > You received this message because you are subscribed to the Google Groups > "Vagrant" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/vagrant-up/7e393032-8a8f-40e2-ab95-3a4914531bf0%40googlegroups.com > <https://groups.google.com/d/msgid/vagrant-up/7e393032-8a8f-40e2-ab95-3a4914531bf0%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/vagrant/issues IRC: #vagrant on Freenode --- You received this message because you are subscribed to the Google Groups "Vagrant" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0ew3s8r-WsBzRCpLVgoF1PJywnmTeKfY6SzkwwAM2k-8LQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
