Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
800 views
in Technique[技术] by (71.8m points)

mongodb - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

(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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...