Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't create working meteor.js project on a vagrant box

I cannot start up a new Meteor application on a Vagrant linux box (running on a Mac). It fails every time with a 'unspecified uncaught exception' in Mongo. I have tried a bunch of things to get this going, but even with the simplest set-up, I cannot get the project running. I would be grateful for any suggestions.

My steps are:

  1. create a completely clean Vagrant box ("ubuntu/trusty64");
  2. install Meteor on the new box (curl https://install.meteor.com/ | sh);
  3. choose a location to create the project;
  4. create a new Meteor project (meteor create app);
  5. start up the project (cd app; meteor)

I know that the permissions on the vagrant shared folder are quirky, so for step #3 above I have tried putting the project:

  1. in the shared guest/host folder, /vagrant,
  2. in a subdirectory of the Vagrant home folder (/home/vagrant),
  3. in a subdirectory of / (with permissions set to vagrant:vagrant), and
  4. in a subdirectory of / with permissions set to root:root, the project created with sudo meteor create app and run with sudo meteor

In all cases, I see this error:

=> Started proxy.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start Mongo server.
MongoDB had an unspecified uncaught exception.
This can be caused by MongoDB being unable to write to a local database.
Check that you have permissions to write to .meteor/local. MongoDB does
not support filesystems like NFS that do not allow file locking.

I cannot tell if this is a Vagrant issue (though I think not, given what I've tried) or a Meteor issue, but I suspect it is Meteor (or one of its many dependencies). I doubt it is a permissions issue, since it failed when running as root. I've tried building meteor from scratch and the build fails and I've tried creating the project with --release 0.9.0 and --release 0.9.2-rc1 and the download is simply killed without explanation.

like image 272
Andrew Avatar asked Sep 07 '14 16:09

Andrew


1 Answers

(1) After step 2 'install Meteor on the new box (curl https://install.meteor.com/ | sh)'

user$ cd /vagrant
user:/vagrant$ meteor create myApp

You should see the myApp folder on your Mac host (the same folder for the vagrantfile)

(2) Insides the myApp folder, you will see the default .meteor folder, make a folder called local if it is no there

user:/vagrant$ cd myApp/.meteor
user:/vagrant/myApp/.meteor$ mkdir local

(3) Create the same folder structure in the /home/vagrant

user:/vagrant/myApp/.meteor$ cd ~
~$mkdir -p myApp/.meteor/local

(4) Link or mount the /vagrant/myApp/.meteor/local to /home/vagrant/myApp/.meteor/local

sudo mount --bind /home/vagrant/myApp/.meteor/local/ /vagrant/myApp/.meteor/local/

or make it permanently

echo “sudo mount --bind /home/vagrant/myApp/.meteor/local/ /vagrant/myApp/.meteor/local/” >> ~/.bashrc && source ~/.bashrc

(5) Now you can start the meteor

~$cd /vagrant/myApp
user:/vagrant/myApp$meteor

The reason why I mount the local folder rather than the <.meteor> folder is that you can still edit the files insides the <.meteor> folder on your Mac host. You can replace myApp with whatever name you want

Hope this help

like image 81
Green Avatar answered Sep 22 '22 03:09

Green