Ember cli inside a Vagrant box?

Has anyone managed to get a vagrant box setup inside a vagrant box?

I seem to just get loads and loads of issues around permissions or user context.

I am using NVM to stop the necessity to use sudo with NPM but that’s still not working!

here is my bootstrap.sh (ran as a shell provisioner from the Vagrantfile):

sudo -u vagrant curl https://raw.githubusercontent.com/creationix/nvm/v0.17.2/install.sh | bash

sudo -u vagrant source ~/.nvm/nvm.sh

sudo -u vagrant nvm install 0.11.14

cd /vagrant/sonatribe-ui

sudo -u vagrant npm install -g --save-dev bower
sudo -u vagrant npm install --save-dev ember-cli

sudo -u vagrant npm install
sudo -u vagrant bower install

Running with sudo -u vagrant emmits “npm not found” type errors, running without seems to run fine but then when I go into the box as vagrant I get ‘npm not found’ errors again…

Has anyone successfully managed to get this working?

We had success with installing and running everything on the Vagrant box as root user[1]. If you are interested in how this works I can try to gather some detailed instructions and post them here.

[1] not perfect but it works

Running as root is very hectic. I ended up running with nvm and installed with privelliged false for that part.

Seems to work

We got lots of errors when running ember serve and syncing changes from the host. It seems that LiveReload picks up the file changes faster than vagrant is able to correctly sync and set the correct owner/permissions on the synced files.

How do you sync files between your host and the vagrant box?

I just use the /vagrant share

Even though my files do get synced, ember-cli (or broccoli) don’t trigger the rebuild. I created an issue here on broccoli repo https://github.com/broccolijs/broccoli/issues/257

I ran into the same problem today. Try using

ember serve --watch polling

This tells sane to use polling which handles vagrant file sync better

1 Like