SyntaxError:Strict mode does not allow function declaration in a lexically nested statement.

React-native安卓错误 SyntaxError: Strict mode does not allow function declarations in a lexically nested_IOS
Paste_Image.png

解决办法
这个问题是官方遗留的问题.不要怀疑你自己


打开node_modules / react-native / Libraries / Core / InitializeCore.js第112
行将函数handleError(e,isFatal)更改为var handleError = function(e,isFatal)


很多小伙伴找不到这个目录,那是因为版本不同.再放出一个路径


node_modules / react-native / Libraries / JavaScriptAppEngine / Initialization / InitializeJavaScriptAppEngine.js


线〜120


最后还要写一段命令行


npm start -- --reset-cache

其实你也可以这么做


React-native安卓错误 SyntaxError: Strict mode does not allow function declarations in a lexically nested_IOS
Paste_Image.png

开启debug 调试模式


然后就可以运行项目了




猜你喜欢

转载自blog.csdn.net/qq_21937107/article/details/82912002