Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Got JS Exception: ReferenceError: Can't find variable: process

After upgrading from react-native 0.26 to 0.29 (and running react-native upgrade), I'm getting the following error in the android debugger:

Got JS Exception: ReferenceError: Can't find variable: process

And this error message in the android emulator

java.lang.RunTimeException: ReferenceError: can't find variable process
 (http://10.0.2.2:8081/index.android.bundle (...)

I haven't changed any of my app javascript since upgrading, and everything ran without errors before so I'm assuming the problem isn't in the javascript, but rather the change of react versions has removed the 'process' variable?

Even loading an empty index file (a single react component that does nothing) still results in the same error.

like image 946
Lucas Penney Avatar asked Jul 18 '16 22:07

Lucas Penney


People also ask

Why does JavaScript presents a ReferenceError when assignment to undeclared variable?

Exactly same happens with JavaScript too. When any value is assigned to undeclared variable or assignment without the var keyword or variable is not in your current scope, it might lead to unexpected results and that’s why JavaScript presents a ReferenceError: assignment to undeclared variable "x" in strict mode.

What does this JavaScript exception variable is not defined mean?

This JavaScript exception variable is not defined occurs if there is a non-existent variable that is referenced somewhere. There is a non-existent variable that is referenced somewhere in the script. That variable has to be declared, or make sure the variable is available in the current script or scope.

Is it possible to generate a reference error in JavaScript?

Likewise there are many scripting factors possible to generate reference error in javascript. Saif Sadiq is a Product Growth specialist at LambdaTest and Growth Marketer. Saif Sadiq is a Product Growth specialist at LambdaTest.

Why is my variable not available in the script?

There is a non-existent variable that is referenced somewhere in the script. That variable has to be declared, or make sure the variable is available in the current script or scope. Example 1: In this example, the variable (val1) is being accessed from the outside of the function, So the error has not occurred.


1 Answers

Had the same issue:

java.lang.RuntimeException: java.util.concurrent.ExecutionException:
java.lang.RuntimeException: ReferenceError: Can't find variable: process

Fixed by upgrading the React to the latest compatible version, 15.2.1 in my case:

npm i [email protected] --save
like image 198
maxnk Avatar answered Nov 15 '22 10:11

maxnk