首页 > 解决方案 > 无法在 iOS 模拟器错误上运行成功构建的 react-native 项目

问题描述

我正在使用react-native编写一个APP,但是今天早上我从github上拉出来后,我发现我无法运行它了。命令行中的日志如下:</p>

** 构建成功 ** 以下命令产生了分析器问题:Analyze Base/RCTModuleMethod.mm normal x86_64(1 个带有分析器问题的命令)

“react-native start”命令行中的日志如下:错误:捆绑失败:TypeError:Cannot read property 'bindings' of null at Scope.moveBindingTo (/Users/martin/Desktop/ble-server/node_modules/@babel/ traverse/lib/scope/index.js:978:13) 在 BlockScoping.updateScopeInfo (/Users/martin/Desktop/ble-server/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js: 364:17) 在 BlockScoping.run (/Users/martin/Desktop/ble-server/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:330:12) 在 PluginPass.BlockStatementSwitchStatementProgram (/用户/martin/Desktop/ble-server/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:70:24) 在 newFn (/Users/martin/Desktop/ble-server/node_modules/ @babel/traverse/lib/visitors.js:237:21) 在 NodePath。_call (/Users/martin/Desktop/ble-server/node_modules/@babel/traverse/lib/path/context.js:65:20) 在 NodePath.call (/Users/martin/Desktop/ble-server/node_modules/ @babel/traverse/lib/path/context.js:40:17) 在 NodePath.visit (/Users/martin/Desktop/ble-server/node_modules/@babel/traverse/lib/path/context.js:100: 12) 在 TraversalContext.visitQueue (/Users/martin/Desktop/ble-server/node_modules/@babel/traverse/lib/context.js:142:16) BUNDLE [ios, dev] ../../index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1),失败。visitQueue (/Users/martin/Desktop/ble-server/node_modules/@babel/traverse/lib/context.js:142:16) BUNDLE [ios, dev] ../../index.js ░░░░░ ░░░░░░░░░░░ 0.0% (0/1),失败。visitQueue (/Users/martin/Desktop/ble-server/node_modules/@babel/traverse/lib/context.js:142:16) BUNDLE [ios, dev] ../../index.js ░░░░░ ░░░░░░░░░░░ 0.0% (0/1),失败。

我怎么能再次运行它,似乎代码没有问题。

标签: react-native

解决方案


您可能错误地更新了 react-native 请查看文档。你可能用过

npm 审计修复
它更新了 react-native。

要解决此问题,您可以使用降级应用程序的 react-native 版本

npm install react-native@xxx"

然后重新编译项目

react-native run-ios"

并且不要忘记重新启动捆绑器

反应原生开始

然后,如果您仍想升级 react-native 版本,您可以使用

反应本机 git 升级

推荐阅读