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

你离开我真会死。 提交于 2019-12-23 09:49:49

问题


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.


回答1:


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 react@15.2.1 --save



回答2:


I had this issue, it turns out my problem was that I didn't stop and restart the packager after upgrading react-native.



来源:https://stackoverflow.com/questions/38446937/got-js-exception-referenceerror-cant-find-variable-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!