Create-react-native-app: Building JavaScript bundle often gets stuck at 0%

Created on 19 Dec 2017  路  10Comments  路  Source: expo/create-react-native-app

Description

When the Expo app starts and I click on my project, 1 out of every 3-4 times it gets stuck. This also happens with the same frequency when I have live reloading enabled and save my changes. The text at the bottom of the screen says "Building JavaScript Bundle..." and to the right is written 0.00%.
When this happens, I have to restart the project from Expo XDE and shut down the app on my phone and restart it for it to work again.

Expected Behavior

When I reload the app after changing code, or when I start it up, it should finish building the javascript bundle and start my app.

Observed Behavior

The loading indicator gets stuck at 0%.

If there's an error message, please paste the full terminal output and error message in this code block:

No error message. I can't even shake the phone so I can get the developer tools.

Environment

Please run these commands in the project folder and fill in their results:

  • npm ls react-native-scripts: It says empty.

  • npm ls react-native:

UNMET DEPENDENCY react-native@https://github.com/expo/react-native/archive/sdk-23.0.1.tar.gz 

npm ERR! missing: react-native@https://github.com/expo/react-native/archive/sdk-23.0.1.tar.gz, required by [email protected]
npm ERR! extraneous: react-native@https://github.com/expo/react-native/archive/sdk-23.0.1.tar.gz FOLDERPATH/app/node_modules/react-native
  • npm ls expo:
UNMET DEPENDENCY [email protected] 

npm ERR! missing: [email protected], required by [email protected]
npm ERR! extraneous: [email protected] FOLDERPATH/app/node_modules/expo
  • node -v: v8.7.0
  • npm -v: 5.5.1
  • yarn --version: 1.3.2
  • watchman version: 4.9.0

Also specify:

  1. Operating system: MacOS High Sierra 10.13.1
  2. Phone/emulator/simulator & version: iPhone 6s

Here's my package.json if that's of any help.

{
  "name": "MYAPPNAME",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-jest": "^21.2.0",
    "babel-plugin-transform-react-jsx-source": "^6.22.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react-native": "^4.0.0",
    "enzyme": "^3.2.0",
    "jest": "^21.2.1",
    "jest-expo": "^24.0.0",
    "prettier": "^1.7.4",
    "prettier-eslint": "^8.2.1",
    "react-native-scripts": "1.3.1",
    "react-test-renderer": "^16.0.0"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "jest"
  },
  "jest": {
    "preset": "jest-expo",
    "testPathIgnorePatterns": [
      "/node_modules/"
    ]
  },
  "dependencies": {
    "axios": "^0.16.2",
    "expo": "^24.0.0",
    "firebase": "^4.5.1",
    "lodash": "^4.17.4",
    "moment": "^2.19.1",
    "prop-types": "^15.6.0",
    "react": "16.0.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-24.0.0.tar.gz",
    "react-native-autocomplete-input": "^3.4.0",
    "react-native-azure-ad": "^0.2.4",
    "react-native-img-cache": "^1.5.3",
    "react-native-router-flux": "^4.0.0-beta.21",
    "react-native-slider": "^0.11.0",
    "react-redux": "^5.0.6",
    "redux": "^3.7.2",
    "redux-thunk": "^2.2.0",
    "watchman": "^1.0.0"
  }
}

Most helpful comment

Just got this issue, I can't build my JS bundle anymore. Deleting node_modules & package-lock.json did not help.

Edit:
This stack overflow answer helped: https://stackoverflow.com/a/45477185/4829109
=> Delete the content of /usr/local/var/run/watchman/

All 10 comments

is this still an issue?

I'm running into this issue
Operating system: MacOS Sierra 10.12.6
Phone/emulator/simulator & version: iPhone 5s

Tried to run the project via XCode and "react-native run-ios", both are showing
Bundling 'index.ios.js' 0.0% (0/1)

have same kind of issue, I can't run my demo app that I was developing all of sudden. That was working few hours ago.
Then I updated Exp version to version 49 but same issue. In CLI the javascript building stuck at 0% and then just show time in miliseconds it ran, then same issue noticed in Mobile (connected to computer), and my app Splash screen loaded, but "Building javascript bundle" message is appearing but stuck to 0%.

It's no longer an issue for me after

  • deleting the /node_modules folder and package-lock.json file
  • closing these windows/programs: react-native cli, Xcode and simulator
  • restarting the computer (prob unnecessary)
  • running npm install

Same issue. Reinstall dependencies is not helping.

Getting this with react-native init lately.
I am not any longer able to run my React Native Apps. Not sure what's wrong here.

Just got this issue, I can't build my JS bundle anymore. Deleting node_modules & package-lock.json did not help.

Edit:
This stack overflow answer helped: https://stackoverflow.com/a/45477185/4829109
=> Delete the content of /usr/local/var/run/watchman/

I found a lot of react-native errors are being silenced by Expo's xdl > PackagerLogsStream class.

See https://github.com/expo/expo/issues/1537

Sooo anyone solved the issue already? I'm having the same issue with expo on windows 10

There are some problems with watchman. But running watchman --foreground in a separate terminal solved the issue with stucked build for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

scf4 picture scf4  路  5Comments

noelweichbrodt picture noelweichbrodt  路  3Comments

mwq27 picture mwq27  路  5Comments

andyvanosdale picture andyvanosdale  路  3Comments

FezVrasta picture FezVrasta  路  3Comments