Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

"Error: Cannot find module 'metro-core'" when starting an Expo project

Writer Olivia Zamora

Whenever I start Expo Go with the expo start command, this error appears :

Error: Cannot find module 'metro-core'
Require stack:
- /usr/local/lib/node_modules/expo/node_modules/@expo/cli/build/src/start/server/metro/instantiateMetro.js
- /usr/local/lib/node_modules/expo/node_modules/@expo/cli/build/src/start/server/metro/MetroBundlerDevServer.js
- /usr/local/lib/node_modules/expo/node_modules/@expo/cli/build/src/start/server/DevServerManager.js
- /usr/local/lib/node_modules/expo/node_modules/@expo/cli/build/src/start/startAsync.js
- /usr/local/lib/node_modules/expo/node_modules/@expo/cli/build/src/start/index.js
- /usr/local/lib/node_modules/expo/node_modules/@expo/cli/build/bin/cli

I have tried to reinstall metro-core, but with no effect.

6 Answers

you are running expo start, try run

npx expo start 

This should work. Let me know if this works.

3

I had uninstalled React Native and installed it again. Then, it worked!

Also, there were some network issues when I scan the QR code using expo go app. The solution was to change the connection from LAN to tunnel using expo start --tunnel command.

1
  1. Delete the file package-lock.json and the (BIG!) directory node_modules.

  2. Run npm install. (This may take a while, up to a few minutes.)

  3. Finally, run npm start and see if the error is gone. 1

Note!

  1. The fact that you run expo start instead of npx expo start indicates that you haven't installed the Expo project locally. The official way to install Expo used to be npm install -g expo-cli. At the time of writing, the official way is instead a local installation :
    npx create-expo-app Your-project-name.
    Then change directory to your project, cd Your-project-name.
    (Running npm install at this point is a good idea.)
    Finally, run npm start to start your Expo project.
    Do not install the expo package globally. 2

  2. Here is a screenshot of the error Cannot find module 'metro-core' …

Error: Cannot find module 'metro-core'

  1. The react-native package depends directly on metro-runtime. My best guess is that there is some intricate bug in one or both of those packages – or in some package that they depend on. Very hard to tell. Very hard to reproduce, as this happens intermittently.

1Whether you run npm start – or npx expo start – or npm run start should not make any difference at all.

2To uninstall, run npm -g uninstall expo-cli (or yarn global remove expo-cli).

I am on Linux machine. expo start gives the same error. Instead

 npm run start 

works without issue

I kind of encountered this problem right now, and the reason it occured was running npm audit fix --forceWhich was leaving a danger message of vulnerability. I had to reinstall react-native to

Install the metro packages globally with:npm i -g metro metro-core

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.