react-native: App force close on release mode: undefined is not an object (evaluating 'e.length')
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment: OS: macOS High Sierra 10.13 Node: 8.9.0 Yarn: 1.2.1 npm: 5.5.1 Watchman: 4.7.0 Xcode: Xcode 9.1 Build version 9B37 Android Studio: 3.0 AI-171.4402976
Packages: (wanted => installed) react: ^16.0.0 => 16.0.0 react-native: ^0.50.2 => 0.50.2
Target Platform: iOS (11.1)
Steps to Reproduce
- App with React Native v0.50+ installed
- Run debug build (works)
- Run release build (crash on app open)
Expected Behavior
Not crash
Actual Behavior
Crash on app open with this error:
RCTFatalException: Unhandled JS Exception: undefined is not an object (evaluating 'e.length')'
Stack points inside the color-converter package.
Current workaround
- Downgrade to 0.49.5
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 38
- Comments: 47 (7 by maintainers)
My solution:
remove
resolutions
from package.jsonand build steps:
Everything ok!
I was able to fix the problem by resolving the
color-convert
package to use the pull request here: Qix-/color-convert/pull/49just changed my package.json to include:
"resolutions": { "color-convert": "github:zbarbuto/color-convert" }
this is just a workaround though since other packages might declare the same var twice which breaks uglify
TO ANYONE WHO FINDS THEMSELVES HERE: This issue has been resolved with a recent publish to
uglify-es
npm package. There is no longer a need for any of these hacky workarounds. Simply remove thenode_modules/metro-bundler
module andnpm i
, or wipe all yournode_modules
andnpm i
(the later is heavier on bandwidth).This also isn’t directly an issue with metro-bundler or react-native, so this issue can probably be closed.
@thphu Your issue is similar to https://github.com/facebook/react-native/issues/16567
View.propTypes
have been deprecated. but some code or dependent package is still usingView.propTypes
in your project. check it: https://github.com/facebook/react-native/issues/16567#issuecomment-340041357Same here! 0.50.2
Hi,
I think a have a same issue with @brunolemos when I upgrade my project from react-native 0.45 to 0.50.3, but my error is a bit difference
I tried to install the latest metro-bundler like @th317erd said, but can’t fix it. PS: debug mode everything is perfect 😦
The root cause is a bug in uglify-js: https://github.com/mishoo/UglifyJS2/issues/2449
Fixed in this pull request: https://github.com/mishoo/UglifyJS2/pull/2458
You can wait for a
react-native
upgrade or resolveuglify-js
from the pull request (temporarily) in yourpackage.json
:I did some digging around and was able to get it to “work”… Not sure if this is the same change as @dotansimha made or not… So perhaps the issue is actually related to changed made in https://github.com/mishoo/UglifyJS2
I modified the minify function in
node_modules/metro-bundler/src/JSTransformer/worker/minify.js
file fromto
@brunolemos not working here.
still crashed on build release. happen when some of native-base componen touched.
Upgraded react-native to the latest version and this is no longer an issue.
In my case,
c.View.propTypes.style
causes crash.I run the app in release mode with
react-native run-ios --configuration Release
for debug it easily and see the report in Crashlytics. Then I see the error and solve it.@th317erd i think this would be lost on every npm install