Meteor: Unexpected mongo exit code 100. Restarting

2019-01-23 18:13发布

问题:

I had to force reboot my mac and now get the following error when trying to start one particular meteor app on localhost.

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 doesnot support filesystems like NFS that do not allow file locking.

Everything was working fine and no major changes were made before the error appeared. Have looked around at other threads relating to the problem but so far none of the answers I found have fixed it. The main suggestion seems to be deleting the mongod.lock file and re-tstarting app as normal but that hasn't worked. I also checked and verified that I have read/write permissions for the file.

Another suggestion is using meteor reset but I can't use that because I need the data currently in the apps db and a reset will wipe it.

Other stuff I tried without success. Mostly everything on this thread. Problems to run examples in Meteor.

also tried simply running sudo meteor as one of the most recent answers suggested in thread above.

I ran mongod directly from the meteor installation directory on my system and it starts up mongodb on port 27017 without any issues.

In desperation I've also tried making a new app and importing the files/folders from the broken one into it. That boots fine but I can't log which suggests the related mongodb is not connected to the new app instance.

Is there a way to stop all meteor specific mongo processes from the terminal specifically to make sure no hidden process is causing the problem? I seem to remember having a similar problem with postgres before that was solved in this way. But for the moment I am out of ideas.

Most of the previous threads on this issue are fairly old so if any one has ran into this problem recently and fixed it in some way other than those suggested I'd be really grateful for help getting my app up and running again. If not some advice on how to do a data dump/restore to a new app without needing the meteor app to be running is much appreciated.

Sorry for long winded question and thanks in advance!

EDIT: This question was flagged as a possible duplicate and as being solved here Meteor: unexpected mongo exit code 100. None of the answers supplied there directly solved it for me though. A bit of extra trial and a combination of several previous answers fixed it for my case. I will post my answer below.

回答1:

These are the steps that solved my instance of this problem.

  1. Delete .meteor/local/db/mongod.lock
  2. Delete .meteor/local/db/journal/j.*(note: I only moved it just in case! ;D)
  3. sudo meteor

sudo might not be necessary but it was the only way back into the app for me. Hope that saves someone a bit of time getting back up and running.