How do i stop expo from running in the web

Viewed 4192

I recently started react-native, after installing all dependencies i tried starting my project but when it starts i don"t seem to find the QR code scanner for me to scan with my device anywhere, instead it starts in the browser, it says web Starting Webpack on port 19006 in development mode.

  • Expo Webpack █████████████████████████ building (40%) 194/196 modules 2 active node_modules\invariant\browser.js

i 「wds」: Project is running at http://0.0.0.0:19006/ i 「wds」: webpack output is served from / i 「wds」: Content not from webpack is served from C:\Users\user\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\webpack-config\web-default i 「wds」: 404s will fallback to /

. I want expo to run on my device not the browser.

4 Answers

Try

  1. Deleting all the metro packages from project_root/node_modules.
  2. Run npm install in project_root.
  3. Now run expo start again and it should work.

This seems to help in most cases

In your app.json you can set wich platforms you want, like this

"platforms": [
    "android",
    "ios"
 ]

The problem is :

When you use react-native-web, Metro uses webpack to pack your code to be available for web.

Something is wrong with the installation (a bug maybe) so metro cannot pack for running the code on a simulator or on a device.

The simptom is you cannot see the QR Code when npm start wright ?

The Solution : Customize webpack https://docs.expo.io/guides/customizing-webpack/

This procedure creates the file webpack.config.js on the roor directory of your project.

Running the expo customize:web will create webpack.config.js

This action solves the problem. You will see the QR again and will be able to run your app in a device, simulator and web.

I had this problem after installing some packages, and i did npm install and it worked

Related