Meteor create errors on OSX

I was getting following errors while create meteor create on OSX El Capitan. I figured out that it as an issue related to permissions. Running “sudo meteor create myapp” worked fine. Putting out this post for community KB.

$ meteor create myapp
Retrying after error { [Error: SQLITE_CANTOPEN: unable to open database file] stack: [Getter] }
Retrying after error { [Error: SQLITE_CANTOPEN: unable to open database file] stack: [Getter] }

/Users/santosh/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:278
throw(ex);
^
Error: SQLITE_CANTOPEN: unable to open database file
at Object.Future.wait (/Users/santosh/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:398:15)
at [object Object]._.extend.execute (/tools/packaging/catalog/catalog-remote.js:368:22)
at /tools/packaging/catalog/catalog-remote.js:145:10
at [object Object].
.extend.retry (/tools/packaging/catalog/catalog-remote.js:157:16)
at new Db (/tools/packaging/catalog/catalog-remote.js:144:8)
at [object Object].
.extend.initialize (/tools/packaging/catalog/catalog-remote.js:703:15)
at /tools/cli/main.js:748:20
- - - - -

As mentioned earlier. Following did the trick:

$ sudo meteor create myapp
Created a new Meteor app in ‘myapp’.

To run your new app:
cd myapp
meteor

If you are new to Meteor, try some of the learning resources here:
https://www.meteor.com/learn

This is a UNIX permissions issue. You might have installed Meteor as root, thus the base files belong to root and your regular user does not have the permissions to read/write files belonging to root.

Since the meteor install is into the users $HOME directory, you probably should not do it as root.

Actually, my initial install ran into issues without being root.

  1. meteor could not be copied into /usr/local/bin as there was a permission issue. However, install script didn’t report errors.
  2. I manually copied meteor into /usr/local/bin
  3. upon running meteor create. I got following error:

`meteor create simple-todos
/usr/local/bin/meteor: line 135: /usr/local/bin/dev_bundle/bin/node: No such file or directory
/usr/local/bin/meteor: line 135: exec: /usr/local/bin/dev_bundle/bin/node: cannot execute: No such file or directory
Santoshs-MacBook-Pro:meteor santosh$ meteor create simple-todos
/usr/local/bin/meteor: line 135: /usr/local/bin/dev_bundle/bin/node: No such file or directory
/usr/local/bin/meteor: line 135: exec: /usr/local/bin/dev_bundle/bin/node: cannot execute: No such file or directory


This forced me to install meteor as root.

Since I also use homebrew, I simply gave my user account full access to /usr/local.

I seem to have some similar issue although I recently did the install on a MBP with el capitan without issue but on my desktop I’m finding I can’t run any of the meteor commands EXCEPT CREATE without sudo I have done

sudo chown -R whoami /usr/local/bin/meteor

but still I can’t run any of the commands without sudo… so after creating using

meteor create

which creates the application and I get the standard "to run your new app:…"If I do

meteor

dyld: lazy symbol binding failed: Symbol not found: _node_module_register
Referenced from: /Users/[user]/.node/lib/node_modules/kerberos/build/Release/kerberos.node
Expected in: dynamic lookup

dyld: Symbol not found: _node_module_register
Referenced from: /Users/[user]/.node/lib/node_modules/kerberos/build/Release/kerberos.node
Expected in: dynamic lookup

Trace/BPT trap: 5

If I run

sudo meteor

everything works fine… if I ‘ctrl+c’ to stop the application and do

meteor

I get …

=> Started proxy.
Unexpected mongo exit code 45. Restarting.
Unexpected mongo exit code 45. Restarting.
Unexpected mongo exit code 45. Restarting.
Can’t start Mongo server.
MongoDB cannot open or obtain a lock on a file

if I

sudo meteor

again it works

once you run it with sudo, files created are owned by root. Why is your meteor referencing files in /Users/[user]/.node? Who owns that directory? All you need to do is make sure your [user] has write privileges on /usr/local/bin, so when you install meteor for the first time it can copy the meteor shell script to /usr/local/bin.

Check who own /Users/[user]/.meteor and the files underneath. They should be owned by [user]. Also, when you do sudo meteor create simple-todos the resulting directory and files are owned by root and you will always have problems.

my bin permissions look like …

drwxrwxr-x 263 [user] wheel 8942 Mar 29 20:09 bin

If I ls -l on ~/.meteor I get …
lrwxr-xr-x 1 [user] staff 52 Mar 27 23:33 meteor -> packages/meteor-tool/1.3.0_3/mt-os.osx.x86_64/meteor drwxr-xr-x 3 [user] staff 102 Mar 27 23:33 package-metadata drwxr-xr-x 148 [user] staff 5032 Mar 27 23:32 packages
When I initially create the meteor application I am not using sudo and it works fine - but when I attempt to run the application that is what is requiring sudo.

EDIT
I noticed that on the MBP - the /usr/local/bin is owned by root but on the desktop is owned by [user] - on the desktop I have homebrew installed perhaps this is the issue?