navalsaini
navalsaini

Reputation: 522

Expo build error is not descriptive - Failed building JavaScript bundle

I often get this error when changing things in my react-native project.

17:27:35: Failed building JavaScript bundle
17:27:42: Warning: 'react' peer dependency missing. Run `npm ls` in /Users/navalsaini/hf/nativeapp to see full warning.
17:27:42: 
17:27:42: If there is an issue running your project, please run `npm install` in /Users/navalsaini/hf/nativeapp and restart.
Building JavaScript bundle [========================================================================================= ] 99

Additionally when I run an eslint, I dont get any issues. (The ones blow are not entirely related to my code and I get them anyway - even when the project works)

/Users/navalsaini/hf/nativeapp/src/platforms/native/utils/fbAuth.js
  7:33  error  'Expo' is not defined  no-undef

✖ 1 problems (1 errors, 0 warnings)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] lint: `eslint . --fix`

Is there a better way to configure my expo build system?

My eslintrc looks as below.

cat .eslintrc.json 
{
  "extends": "expo/native",
  "rules": {
    "react/jsx-no-bind": [false]
  }
}

This is important because it is a huge waste of my time.

Upvotes: 0

Views: 719

Answers (1)

navalsaini
navalsaini

Reputation: 522

I have realised that if I want to know the exact build error, this is what works for me.

  1. Push the currently modified code in repo to stash and go to last working commit
  2. The application runs (as we are on a working commit)
  3. Apply the stash - this triggers a rebuild while expo is running (and does not crash expo)

The build errors are dumped on simulator screen with a red background.

This does save me time as compared to tracing which change made the build break.

Upvotes: 2

Related Questions