4

该应用程序安装在模拟器中。但它并没有开始。模拟器指出了这个错误。

同时服务器给出以下错误。

错误:捆绑失败:TypeError:无法在_default(C: \Users\sajithk\UTransP\node_modules\babel-preset-react-native\node_modules\@babel\plugin-transform-b​​lock-scoping\lib\index.js:19:36) 在 Function.memoisePluginContainer (C:\Users\ sajithk\UTransP\node_modules\babel-core\lib\transformation\file\options\option-manager.js:113:13) 在 Function.normalisePlugin (C:\Users\sajithk\UTransP\node_modules\babel-core\lib\ transformation\file\options\option-manager.js:146:32) 在 C:\Users\sajithk\UTransP\node_modules\babel-core\lib\transformation\file\options\option-manager.js:184:30 在Array.map() 在 Function.normalisePlugins (C:\Users\sajithk\UTransP\node_modules\babel-core\lib\transformation\file\options\option-manager.js:158:20) 在 OptionManager.mergeOptions (C:\Users\sajithk\UTransP\node_modules\babel-core \lib\transformation\file\options\option-manager.js:234:36) 在 C:\Users\sajithk\UTransP\node_modules\babel-core\lib\transformation\file\options\option-manager.js:265 :14 在 C:\Users\sajithk\UTransP\node_modules\babel-core\lib\transformation\file\options\option-manager.js:323:22 BUNDLE [android, dev] ./index.js ░░░░ ░░░░░░░░░░░░ 0.0% (0/1),失败。\Users\sajithk\UTransP\node_modules\babel-core\lib\transformation\file\options\option-manager.js:265:14 在 C:\Users\sajithk\UTransP\node_modules\babel-core\lib\transformation\ file\options\option-manager.js:323:22 BUNDLE [android, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1),失败。\Users\sajithk\UTransP\node_modules\babel-core\lib\transformation\file\options\option-manager.js:265:14 在 C:\Users\sajithk\UTransP\node_modules\babel-core\lib\transformation\ file\options\option-manager.js:323:22 BUNDLE [android, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1),失败。

这是我创建项目后第一次在模拟器中运行应用程序。

4

4 回答 4

4

我遇到了同样的问题,就我而言,我通过将 babel-preset-react-native 版本从 5.0.0 更改为 4.0.0 来解决它

并按照说明进行操作:

  1. 清除守望者手表:watchman watch-del-all
  2. 删除node_modules文件夹:rm -rf node_modules && npm install.
  3. 重置 Metro Bundler 缓存:rm -rf /tmp/metro-bundler-cache-*npm start -- --reset-cache.
  4. 移除急速缓存:rm -rf /tmp/haste-map-react-native-packager-*.
于 2018-04-24T09:15:38.863 回答
0

在控制台中:npx react-native start

于 2021-05-19T10:32:51.320 回答
0

你的babel-preset-react-native版本是什么?

试试这个命令:

npm install --save babel-preset-react-native@2.1.0
于 2018-04-24T05:45:45.353 回答
-2
npm install react-navigation --save

我用上面的方法解决了我的问题,如果有人有同样的问题,请尝试。如果有人知道为什么这个命令可以解决这个问题,我很高兴学习。干杯

于 2021-01-28T06:52:56.727 回答