Error installing Meteor on Mac M1

Hi,

I am trying to make a new install of Meteor on a Macbook M1.

After creating a Terminal for Rosetta 2, I install Meteor with the instructions given in Install | Meteor API Docs

Then I create an app and when running the command

meteor

I get the following response:

=> Started proxy.                             
=> Started HMR server.                        
Unexpected mongo exit code 14. Restarting.    
Unexpected mongo exit code 14. Restarting.    
Unexpected mongo exit code 14. Restarting.    
Unexpected mongo exit code 14. Restarting.    
Can't start Mongo server.                     
Unspecified unrecoverable error. Exit was not clean

I have tried uninstalling and reinstalling several times but always get the same response.

Thank you for your help

I have notes about fixing this from a previous occasion.

try the following to check if mongod is running:

$ ps aux | grep mongod

ppanagi 74251 0.4 0.2 2711840 38340 s004 S+ 4:36PM 0:00.41

and then do sudo kill -9 PID (where PID is 74251 in the above example).

Hi, thank you for your answer. After I run

$ ps aux | grep mongodb

I see that mongodb is not running

Okay, try this:

– I think this may wipe your current mongo db, so you should export it first so as to be able to import it later if necessary.

1 Like

Hey @idejuan,

Make sure you are running a node v14
you can run node -v on your terminal to check the node version

make sure that you have installed MongoDB and it’s running
you can install it using brew
to check if the MongoDB is running, you can simply run brew services and the status should be “Started”
brew install mongodb-community@5.0

let me know if that solves your issue

1 Like

Rosetta shouldn’t be needed anymore. :thinking:

Hi Frederico, hschmaiske

Thank you.
I am running node v16.14.2

I have tried both with Rosetta and regular ARM base. In both cases I get the same error. It has to do with the Mongo server.

When I check

brew services

I get the response that the server is running

Name              Status  User          File
mongodb-community started idejuan ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

Trying meteor

=> Started proxy.                             
=> Started HMR server.                        
Unexpected mongo exit code 14. Restarting.    
Unexpected mongo exit code 14. Restarting.    
Unexpected mongo exit code 14. Restarting.    
Unexpected mongo exit code 14. Restarting.    
Can't start Mongo server.                     
Unspecified unrecoverable error. Exit was not clean

I have also tried restarting the computer and running meteor reset and the result is the same as above.

Is there any log file where I could dig further into the problem?

Thank you!

NodeJS v16 is a little high for the moment. Let’s stick with 14.

Since Meteor brings its own node (and npm and mongoldb), the node version you use besides does not really matter during development (if you deploy it, it’s best/easiest to check meteor node -v and use that version on your server). Rosetta is still needed, because afaik the mongo binaries still aren’t native. If you have mongoldb-community running, it’s probably using the same port that meteor tries to use for it’s own mongodb (27-something). So either exit mongoldb-community or set the mongourl accordingly.

@idejuan, Node v16 didn’t work for me, and it worked when I downgraded to v14. Maybe you can try it?

Followed these steps:

I installed nvm and now run node v.14.19.1.

I reinstalled meteor with curl https://install.meteor.com/ | sh

I made sure that there is no mongodb server running (with brew services)

I run meteor reset and finally meteor

I try with Rosetta and without.

The result is the same:

=> Started proxy.                             
=> Started HMR server.                        
Unexpected mongo exit code 14. Restarting.    
Unexpected mongo exit code 14. Restarting.    
Unexpected mongo exit code 14. Restarting.    
Unexpected mongo exit code 14. Restarting.    
Can't start Mongo server.                     
Unspecified unrecoverable error. Exit was not clean

1 Like

The only difference that I made on my installation was to use npm install -g meteor instead of curl

Can you try this answer? node.js - Meteor: Unexpected mongo exit code 14. Restarting.Can't start mongo server - Stack Overflow

Try:

meteor update --release *LAST STABLE VERSION FOR YOU*
meteor

If it’s still not working, try:

meteor reset
meteor

Otherwise, if that still doesn’t work, try removing the local db folder then running meteor again like this:

rm -r .meteor/local/db folder
meteor

Thank you hschmaiske.

I still get the very same error.

This is what I have tried:

I fully removed meteor, and reinstalled it using npm install -g meteor. I created a new meteor app and run meteor.

I tried both using Rosetta 2 and the regular “M1” based terminal for OSX Monterrey v.12.3

I’m sorry I don’t have the full answer but I just wanted to say you do not need to bother with starting meteor under rosetta. You still need rosetta installed because mongo needs it, but you don’t need to start meteor under rosetta.

Since it is mongo that is crashing, you could consider doing what I do and use a remote mongodb for development.

MONGO_URL=mongodb://user:password@domain.com:27017/app?directConnection=true

https://jamesloper.com/complete-users-setup-guide-meteor-mongodb

3 Likes

Thank you James for the alternative solution