Mac系统搭建react-native开发环境报错

Mac系统搭建react-native开发环境过程中执行
npx react-native init AwesomeProject
cd AwesomeProject yarn react-native run-ios报错
错误日志如下

error: bundling failed: ReferenceError: SHA-1 for file /Users/xxx/AwesomeProject/node_modules/metro/src/lib/polyfills/require.js (/Users/xxx/AwesomeProject/node_modules/metro/src/lib/polyfills/require.js) is not computed
    at DependencyGraph.getSha1 (/Users/xxx/AwesomeProject/node_modules/metro/src/node-haste/DependencyGraph.js:258:13)
    at /Users/xxx/AwesomeProject/node_modules/metro/src/DeltaBundler/Transformer.js:211:26
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/xxx/AwesomeProject/node_modules/metro/src/DeltaBundler/Transformer.js:46:24)
    at _next (/Users/xxx/AwesomeProject/node_modules/metro/src/DeltaBundler/Transformer.js:66:9)
    at /Users/xxx/AwesomeProject/node_modules/metro/src/DeltaBundler/Transformer.js:71:7
    at new Promise (<anonymous>)
    at /Users/xxx/AwesomeProject/node_modules/metro/src/DeltaBundler/Transformer.js:63:12
    at Transformer.transformFile (/Users/xxx/AwesomeProject/node_modules/metro/src/DeltaBundler/Transformer.js:236:7)
    at /Users/xxx/AwesomeProject/node_modules/metro/src/Bundler.js:87:34
 BUNDLE  [android, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (457/457), failed.

请问如何解决?

阅读 2k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏