-
Notifications
You must be signed in to change notification settings - Fork 630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Packager error: "Can't find variable: process" #73
Comments
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. |
Would be good to figure out which module is throwing this. |
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? |
@richardgirges Any updates on this ? |
Please, take a look at this issue. |
Since moment is reverting their fix, a fix in Bundler would be appreciated! |
+1 |
So |
@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. |
Getting this error when trying to run on a device on RN v0.50.2 |
Can confirm that 0.50.2 has this error. It only happens on release build for me though. |
I have this issue too on 0.50.2. Is there any workarounds? |
We have just released metro-bundler v0.20.2, which should solve this issue. Can somebody confirm? |
It seems to fix Debug build (which can be run on ios devices now), however there is another Release build issue now: |
We are seeing the same release build issue in ios, we didn't have any issues with the debug build. The |
@PvanHengel updating to RN |
Upgrading to RN |
RN 0.50.3 does not fix that another issue: |
@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. |
@JuliusMalisauskasDB I resolved this issue with a |
I'm on 0.50.3 and I am still experiencing this issue. |
Can you check which version of metro-bundler are you using? To do so, check for the metro-bundler entry on your This issue was fixed in |
Ran into the same error with a fresh clone+build of a previously functional project.
Did an
Though my
Regardless I'm back up and running. |
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 |
On RN0.50.4, with metro-bundle@0.20.3 I am having this issue. |
@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? |
run My version: react-native -v
react-native-cli: 2.0.1
react-native: 0.50.1 |
@rafeca this is my
|
I am running into this issue as well, I have these versions of the components: |
@rafeca Just hit this issue with metro@0.23.0. 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 |
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 |
Ok, I've just actually been able to reproduce it, a fix is coming |
Also have this issue on react-native 0.52 |
Works for me on 0.52. |
Do you want to request a feature or report a bug?
Bug
Behavior
The issue was initially discovered in #65 after people began using the latest metro-bundler 0.20.0 version to work around dynamic requires in packages like moment.js
Packager throws the following error when bundling:
Repro Steps
react-native run-ios
as normal.NOTE: The fact that this issue manifested for people in metro-bundler@0.20.0 is a red herring. This issue appears to be happening with older versions of metro-bundler as well. I've confirmed the same error appears in metro-bundler@0.19.0. I haven't tried to reproduce it in any versions older than 0.19.0 yet.
Environment
Node: v8.5.0
package.json
The text was updated successfully, but these errors were encountered: