Cannot find module 'metro-core' when starting expo project - react-native

Whenever i start expo with 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.
So, does anyone know the solution ?

you are running expo start, try run
npx expo start
This should work.
Let me know if this works.

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.

Related

I am building an app using Expo but for some reason all of a sudden the 'npm' start command no longer works

I am fairly new to React Native. I am building a basic app using expo-cli. I don't have a deep understanding on how it works, but I've been following tutorials online on how to use it. Today, I was working on it and used 'npm start' command to launch the expo portal so I could demo my app on a virtual machine but it says it can no longer find the link to the .json file. Can someone please help me to get it working again.
Looks like you're one directory up? Try cd WhatsUp and then run npm start again.

how to open / continue expo project in another device with github

I'm pretty new to the expo and developing a mobile app, currently I'm using expo dan react native
I've built an app with the expo and I want to open it on another laptop, so I use GitHub to commit my work there
on the new laptop I already installed expo, node, vs, etc. i cloned the project and can't start it on my new laptop with "npm start"
it shows error like this
"Cannot determine which native SDK version your project uses because the module expo is not installed"
which I already checked on my cmd with expo --version
TL: DR how do I start the expo on another laptop with GitHub?
I already fixed the issue, the console recommended me to do yarn add expo , i already did the yarn add expo before writing this question and it didnt fix me thats why i thought there is something i need to do other than doing that
so after exploring expo documentation and found nothing , i just tried to do yarn add expo BUT in my cmd , not in my console on vs code
it worked perfectly for me and the strange thing is , i cant debug expo in my phone with LAN connection, which now i have to use tunnel connection for this to work where in my old computer i use the LAN connection perfectly fine
TLDR : do yarn add expo in cmd not in vs code console
Did you already clone your repo to your new machine?
If not you should download your code to your new laptop.
Next you will have to cd to the directory of your app in your terminal.
Afterwards you’ll have to run
expo install
And after this is done you can run the following command (still in your app folder)
expo start

'Expo not defined' in React Native

I am working on an App in RN and when trying to run either an Android Emulator or Webpack the error 'Expo not defined' pops up. I have had my instructor look over the code and he hasn't quite figured it out either. The first time I was able to get it working by restarting my computer as well as re-installing node-modules. Any advice? Here is a screenshot.Expo not defined
it looks like you have some code in MainComponent.js that calls Expo.Constants.statusBarHeight - you should remove that
Are you importing Expo in top of file?
import Expo from 'expo';
Can you install expo again?
npm install expo
if u r compiling the code on web then ofc it will show error on expo being undefined but check that app on mobile running expo app it will run there without any error .
Hope it solved your problem

`expo start` in development stuck at "Tunnel Connected", QR code is unusable

I'm currently running a detached expo project in development mode. Whenever I run expo start or npm start in the terminal I get the following logs:
$ expo start
Starting project at /Users/johncd/workspace
Expo DevTools is running at http://localhost:19002
Starting Metro Bundler on port 19001.
Tunnel ready.
Your native app is running at expb675c828acbb437095bc6218883f56bb://192.168.1.12:19000
Logs for your project will appear below. Press Ctrl+C to exit.
The expected results would include a QR code after these logs, but there is none.
When I visit the DevTools at localhost:90002 I see the metro bundler is running on LAN and a QR code is available. However, when I scan this QR code, it results in an error reading "No usable data found".
I've tried checking for a Firewall (System preferences > Privacy > Firewall) but it appears to be turned off.
I have also tried uninstalling and re-installing expo-cli as well as the project and running expo start again but to no avail.
I've tried using npm start and yarn start. I have also tried running the project on a tunnel.
I created a test project using expo init test-project and successfully ran it using expo start, so it seems this issue is only occurring on this project.
I also tried running expo start --clear to clear the cache.
None of these have worked.
Any help is appreciated!
Versions:
"expo": "^33.0.0",
"expo-constants": "^5.0.1",
"expokit": "^33.0.4",
"react": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
"react-native-unimodules": "^0.4.2",]
Running on OSX
You need to install expo client app first from the appstore, then the qr will be readable.
You need to install Expo Go application from app store.
I didn't see anywhere a mention of what platform you're trying to use (iOS or Android) but at least with iOS I can tell you that QR codes in Expo don't really work correctly anymore. I believe Apple prevented the Expo team from being allowed to serve the bundle through the Expo app anymore. What this means for you is that the workflow you should expect is to connect your phone to the device physically using a cable and serve the bundle through USB. You can also use an emulator and move to the device when it's convenient.

Why Expo can not load the project in react-native app?

I'm trying to create my first react-native app.
I installed expo XDE then I create a new project in this way :
create-react-native-app firstProj
Then I open it in expo XDE and in terminal by exp firstProj
But I get this warning ; And this is what is displayed in the emulator :
Any help is appreciated.
Click the setting button in the left top, then change the "Host" to "LAN"
Restart your project
Follow the below steps to create a new expo app from command line:
create-react-native-app my-app
cd my-app/
npm start
npm run ios / npm run android
In a alternate way you can try Expo XDE interface to create a app and run in your device. Here is a official document for creating and sharing your app across your device. If you are interested with their CLI you can follow the below steps
npm install exp --global
exp init your-project-name
cd your-project-name
exp start
Please check whether you have missed any of the steps from the above, it might help you to fix the issue. You might have missed exp start command.
It helped the following in my case:
Install Genymotion with VirtualBox
SignUp at Genymotion site
Run Genymotion software and !!!SignIn
Close npm prompt program with project and start it again
npm start (in the npm promt window in the project directory)
Close and start Expo app, scan barcode
I noted that when my application runs successfully IpV addresses are identical
exp://10.0.0.124:19000 and
ipconfig -> IPv4 Address. . . . . . . . . . . : 10.0.0.124
In My Case, I did this.
by Using Expo.
Just make sure the laptop and mobile connection with the same network.
Make sure that you are selected Lan on the expo web tab.
Stop the npm Server Running.
Close the App on Mobile Also.
Then Start npm Again.
Now Scan the QR Code if the project is not listed up in the expo recent open project app already.
Or click on the already available in recent opens project on the expo.
Note if Still not working then try same after clearing the recent open in expo app.
I knew that this answer is too late but May it help someone.