Comments (35)
@richardgirges Any updates on this ?
from metro.
@PvanHengel updating to RN 0.50.3
fixed this for me... hopefully fixes for you too.
from metro.
Can confirm that 0.50.2 has this error. It only happens on release build for me though.
from metro.
+1
from metro.
We are seeing the same release build issue in ios, we didn't have any issues with the debug build. The Unhandled JS Exception: undefined is not an object (evaluating 'e.length')', reason: 'Unhandled JS Exception: undefined is not an object (evaluating 'e.length')
is a major blocker, do we need to open another issue for that here, or should we keep this one open?
from metro.
It seems to fix Debug build (which can be run on ios devices now), however there is another Release build issue now:
facebook/react-native#16745
from metro.
Upgrading to RN 0.50.3
fixed this same issue for me too with a new project created this week! I hope upgrading fixes this for you all as well, and if you haven't done it before here's the doc: https://facebook.github.io/react-native/docs/upgrading.html cheers!
from metro.
I'm on 0.50.3 and I am still experiencing this issue.
from metro.
On 0.50.4 I am having this issue.
from metro.
Thanks @nsipplswezey for shedding some light. In fact, package manager lock files will prevent updating to the metro version that fixed this issue (v0.20.3).
For anyone stumbling across this issue, remove the metro entry in your package-lock.json/yarn.lock file and npm install
/yarn install
again
from metro.
On RN0.50.4, with [email protected] I am having this issue.
from metro.
Ok, I've just actually been able to reproduce it, a fix is coming
from metro.
I ran into that one last week. It seems to be related to the order things get packaged in - react native polyfills process.env, but does it after react tries to check if it is running in dev mode.
Putting the first RN import before the first react import seems to have fixed it, but it was working fine the other way around on previous versions.
from metro.
Would be good to figure out which module is throwing this.
from metro.
In my case it was react - unlike #65 it’s not just a bundler setting/ error message. Were previous releases perhaps effectively hardcoded to load react native before anything else?
from metro.
Please, take a look at this issue.
from metro.
Since moment is reverting their fix, a fix in Bundler would be appreciated!
from metro.
process
is set up in InitializeCore
module of react-native
.
// InitializeCore.js
// Set up process
global.process = global.process || {};
global.process.env = global.process.env || {};
if (!global.process.env.NODE_ENV) {
global.process.env.NODE_ENV = __DEV__ ? 'development' : 'production';
}
So InitializeCore
module must run before entry module. Previously, runBeforeMainModule
config was specified in defaults.js
where InitializeCore
is included. But it has been removed from metro-bundler
in this commit Make the runBeforeMainModule config param to RN repo and make it absolute recently. However, it seems that there are some problems with this commit, I've created another issue #78 to disscus about this.
from metro.
@tsyeyuanfeng That would explain why things suddenly stopped working.
See also the corresponding RN commit facebook/react-native@34487c0
Looks like that commit isn’t part of 0.49, but is tagged as v0.50.0-rc0 - it will work just fine with facebook’s internal setup (master of both in a single repo) but the open source dependencies are broken at the moment.
from metro.
Getting this error when trying to run on a device on RN v0.50.2
from metro.
I have this issue too on 0.50.2. Is there any workarounds?
from metro.
We have just released metro-bundler v0.20.2, which should solve this issue. Can somebody confirm?
from metro.
RN 0.50.3 does not fix that another issue:
Unhandled JS Exception: undefined is not an object (evaluating 'e.length')
from metro.
@JuliusMalisauskasDB see facebook/react-native#16745 it is related to an issue which has been merged with the color-convert library. I believe the fix was merged.
from metro.
@JuliusMalisauskasDB I resolved this issue with a yarn
resolution
to set color-convert
to 1.9.1. There are a few libraries that seem to depend specifically on 1.9.0. For me it was react-native-svg
from metro.
Can you check which version of metro-bundler are you using? To do so, check for the metro-bundler entry on your yarn.lock
file.
This issue was fixed in v0.20.2
from metro.
Ran into the same error with a fresh clone+build of a previously functional project.
"dependencies": {
"react": "16.0.0",
"react-native": "0.50.4"
},
Did an rm yarn.lock
and rm package-lock.json
and an npm i
.
Now my package-lock.json
is:
"metro-bundler": {
"version": "0.20.3",
"resolved": "https://registry.npmjs.org/metro-bundler/-/metro-bundler-0.20.3.tgz",
Though my node_modules/react-native/package.json
shows
"metro-bundler": "^0.20.1",
Regardless I'm back up and running.
For anyone else stuck on this, my issue seemed to be an old yarn.lock file from maybe from an old yarn install
, when currently I'm using npm install
.
from metro.
@hqro are you sure that the metro version that you're using is 0.20.3? Can you post the whole error stack trace you're getting?
from metro.
run react-native upgrade
and close proxy(I don't think the proxy is the problem , but these are two things I done, after I have this issue) fix this problem.
My version:
react-native -v
react-native-cli: 2.0.1
react-native: 0.50.1
from metro.
@rafeca this is my yarn.lock
metro-bundler@^0.20.1, metro-bundler@^0.20.3:
version "0.20.3"
resolved "https://registry.yarnpkg.com/metro-bundler/-/metro-bundler-0.20.3.tgz#0ded01b64e8963117017b106f75b83cfc34f3656"
from metro.
I am running into this issue as well, I have these versions of the components:
metro-bundler 0.20.3
react 16.0.0
react-native 0.50.3
from metro.
@rafeca Just hit this issue with [email protected]. It only happens when generating a prod bundle. Looking at the bundle a module that uses process.env (in my case invariant) appears before the InitializeCore module. This causes it to be executed before process.env polyfill is setup. As a workaround I added import 'InitializeCore';
at the top of my index.js and now it works.
from metro.
Hey @janicduplessis! Are you trying it with RN master?
I cannot repro it in my silly sample RN app: https://github.com/rafeca/rn-test-app if you have some repro steps I can take a deeper look
from metro.
Also have this issue on react-native 0.52
from metro.
Works for me on 0.52.
from metro.
Related Issues (20)
- [0.73.x] Metro crashes because of `__loadBundleAsync` HOT 6
- Unable to resolve module stream HOT 4
- [0.80.4] Metro bundle duplicated code when use unstable_enablePackageExports and unstable_enableSymlinks HOT 3
- No matching version found for [email protected] HOT 1
- Unable to resolve module when using symlinks. HOT 6
- error Cannot read properties of undefined (reading 'transformFile'). TypeError: Cannot read properties of undefined (reading 'transformFile') HOT 2
- Metro uses watchman that leaks watched files HOT 2
- Default metro resolver slower than MetroSymlinksResolver in a monorepo HOT 3
- React Native application does not update on many code changes when using vim HOT 4
- esm HOT 1
- Performance regression between 0.73.9 and 0.76.8 HOT 4
- Unable to resolve self-referring "subpath exports" from within a haste module HOT 1
- `nodeModulesPaths` not working as expected with React Native HOT 1
- Cannot read property 'transformFile' of undefined HOT 1
- Including local packages from outside project root. Can we do better?
- [BUG] Terser mangler issue after upgrading to RN 0.74.5
- Problem during ReactNative project deployment for iOS HOT 2
- Add types for `require.context` HOT 1
- Package Exports resolution differs from Node in 2 edge cases HOT 3
- Slow bundle download(~2 mins) in dev mode by ReloadCommand(r) on iOS after RN 72 upgrade HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metro.