react-native: Packager / server only logs 'Failed building JavaScript bundle' and does not indicate the problematic file
Is this a bug report?
Yes.
Environment
react-native -v
: 0.47.2node -v
: 6.11.2npm -v
: 3.10.10
- Target Platform: Android
- Development Operating System: Linux, Ubuntu 17.04
- Build tools: just react-native
Steps to Reproduce
- Attach Android device or emulator.
- Clone the example project.
git clone https://github.com/MFAshby/failuretest.git
- Run
npm start
, in the project folder, then pressa
to run on attached Android device. - Get the below text in the console window for packager and development server.
11:09:39 PM: Starting Android… › Press a to open Android device or emulator, or i to open iOS emulator. › Press q to display QR code. › Press r to restart packager, or R to restart packager and clear cache. › Press d to toggle development mode. (current mode: development) 11:09:41 PM: Launching Dev Tools… 11:09:57 PM: Failed building JavaScript bundle 11:09:57 PM: 11:09:57 PM:
Expected Behavior
I would expect some kind of indication as to what bit of javascript is invalid (i.e. file and line number)
Actual Behavior
There is no indication where the javascript syntax is invalid. This slows the development process 'cos now I can’t easily see where I’ve made syntax errors!
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 21
- Comments: 19 (2 by maintainers)
Usually this error is displayed in Expo, but sometimes Expo won’t show it, either because:
The easiest solution is to keep your Expo in a good state. I have found Expo running in the iOS Simulator a bit more user friendly than Expo running in the Android Emulator.
For those of you who are stuck in a situation where Expo is not showing the error… I did manage to get the error logged, but it wasn’t pretty!
Starting with jmatsushita’s pointer I made the following changes:
This got the error displayed on the console. But there must be an easier way… Running a build manually?
Any movement on this? This is most certainly a high priority.
This is making it ridiculously difficult to do any development. I have a syntax error somewhere in my code that I have been hunting for 3 hours.
Unfortunately, @joeytwiddle’s hack doesn’t help me much either…it just produces this:
I’m using
expo
and deactivating the remote debugger (shaking the phone and clicking stop remote debugging) makes the bundler error message show up on the phone. Better than nothing.Please delete the labels of this issue, all the info is on the OP post. For the moment, how do you guys go through this? I can’t handle this anymore, my developing time has increased a lot due to lack of info when writing code and receiving an error.
This issue hasn’t been updated in a while. If anyone is still running into this, please go ahead and open a new, separate issue. This will help us debug the situation individually. When a thread gets to this size, it’s hard to keep track when each problem is actually related to the original post.
It seems that this error comes from the
react-native-scripts
package on this line.