manually do which forever and pass the full path, example /usr/local/bin/forever
On Mon, Jan 27, 2014 at 2:55 AM, John Mark Perocho <[email protected]>wrote: > I'm new to vagrant and I am setting up a Node.js CentOs 6.5 x86_64 > development machine in VirtualBox 4.3.6 and package it to a vagrant box. My > host OS is windows 8.1 Pro. > > What I am trying to do is to create a provision in shell that when running > vagrant > up thebootstrap.sh will check if app.js exist in the project directory if > it doesn't exist it will create a temporary app.js and run forever start > -w app.js. > > Everything is working in the bash script but when it reaches the line forever > start -w app.js I get this error. > > /tmp/vagrant-shell: line 14: forever: command not foundThe following SSH > command responded with a non-zero exit status.Vagrant assumes that this means > the command failed! > > chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell > Stdout from the command: > > > Stderr from the command: > /tmp/vagrant-shell: line 14: forever: command not found > > Running forever start -w app.js in vagrant ssh works fine with no > problem. While searching in google some say that it's a permission settings > problem. I tried adding vagrant user to the admin group and by running the > following commands: > > $ sudo groupadd admin > $ usermod -G admin vagrant > > I also edited /etc/sudoers file and added SSH_AUTH_SOCK to the env_keep > option, commented out the Defaults requiretty line and added the line %admin > ALL=NOPASSWD: ALL. I get the same error. > > Here's my bootstrap.sh > > #!/usr/bin/env bash > IFS='' read -r -d '' NODEAPP <<'EOF'var http = require('http'); > http.createServer(function (req, res) { > res.writeHead(200, {'Content-Type': 'text/plain'}); > res.end('Hello Universe.\n');}).listen(3000, '127.0.0.1'); > console.log('Listening at http://127.0.0.1:3000/'); > EOF > > cd /usr/share/nginx/htmlif [ ! -f app.js ]; then > echo "$NODEAPP" >> app.jsfi > forever start -w app.js > > And here's my Vagrantfile: > > VAGRANTFILE_API_VERSION = "2" > Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| > config.vm.box = "centos65NODE" > config.vm.box_url = "centos65NODE.box" > config.vm.network :private_network, ip: "192.168.50.10" > config.vm.provision :shell, :path => "bootstrap.sh"end > > -- > 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]. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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]. For more options, visit https://groups.google.com/groups/opt_out.
