Search code examples
react-nativeexpocreate-react-native-app

Metro Bundler failed to start. (code: EACCES)


I am running ubuntu 18.04

I get this when trying to start my expo server with exp start (I have also tried exp start -c, exp start -c --tunnel, exp start --tunnel).

I get:

felix:~/job/App (dev) $ exp start
[11:50:59] Using project at /home/felix/job/App
[11:51:08] Scanning folders for symlinks in /home/felix/job/App/node_modules (8ms)
[11:51:08] Starting Metro Bundler on port 19001.
[11:51:08] Metro Bundler ready.
[11:51:08] Successfully ran `adb reverse`. Localhost urls should work on the connected Android device.
[11:51:10] Tunnel ready.
[11:51:10] Expo is ready.

[11:51:10] Your URL is: exp432e0186c47243658eeef37602b6c1c4://10.114.17.163:19000
[11:51:10] Logs for your project will appear below. Press Ctrl+C to exit.
[11:51:15] Metro Bundler failed to start. (code: EACCES)

I have tried reinstalling expo, node modules, metro. I have removed my .expo file so that it could be regenerated.

I have (I think) the right permissions on all my files. I do own the repo in my home directory, i dont know if expo creates any files in my root directories.

Mabye there is a way to check exactly where metro bundler failed and threw the error?

Worth noticing is if I create a new app with create-react-native-app and start the server with exp start then it works!! So there semeems to be something wrong with my this repo? Other people with the same operating system can get this to work by simply cloning the repo and starting it with exp start.


Solution

  • I solved it. The problem was that metro bundler (the program that builds your js files) could not connect to my android emulator. This was due to that the emulator was created by a root user, so therefor metro bundler did not have the correct permissions so therefor it threw a EACCES error.

    What I did was to create a new android emulator with my users permission, then it worked.