Cannot find module ‘@expo/metro-config’ when trying to start the project with expo cli >= 4.8.0

Viewed 694

I recently tried to launch my project on a new computer. I downloaded the source code from its repository and ran npm install to get all the needed packages.

However, when I run npm start or expo start:web, I get the error: Cannot find module '@expo/metro-config'

I ran npm install @expo/metro-config and the install run without issue, but I still get the “Cannot find module '@expo/metro-config'” error. The only post I saw regarding this error recommends editing the metro.config.js but I do not use one.

I am on SDK 42, and the project launches fine on my other computer. Any idea what is happening?

FYI, I use to perform this whole operation without any issue until now.

UPDATE:

I ran npm install -g @expo/metro-config and now I get the error Cannot find module 'resolve-from'

So it looks like maybe running npm install -g expo-cli doesn't actually install all the necessary packages? Could it be the issue?

I managed to make it "work" (get other missing packages errors down the line) by reverting to expo-cli 4.7.3. Anything from 4.8.0 and above will cause the error.

Something else is that on a fresh npm install, after running npm install -g expo-cli, if I try to create a project with expo init, I will get the error Error: Cannot find module 'kleur'. Running npm install kleur fix it, but maybe that's also a clue.

0 Answers
Related