如何解决此本地反应式iOS错误?

时间:2018-11-21 09:57:01

标签: react-native

error: bundling failed: Error: While trying to resolve module `react-native` from file `/Users/ios/Desktop/android/android/index.js`, the package `/Users/ios/Desktop/android/android/node_modules/react-native/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/ios/Desktop/android/android/node_modules/react-native/Libraries/react-native/react-native-implementation.js`. Indeed, none of these files exist:

  * `/Users/ios/Desktop/android/android/node_modules/react-native/Libraries/react-native/react-native-implementation.js(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
  * `/Users/ios/Desktop/android/android/node_modules/react-native/Libraries/react-native/react-native-implementation.js/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
    at ResolutionRequest.resolveDependency (/Users/ios/Desktop/android/android/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:103:15)
    at DependencyGraph.resolveDependency (/Users/ios/Desktop/android/android/node_modules/metro/src/node-haste/DependencyGraph.js:272:4579)
    at dependencies.map.relativePath (/Users/ios/Desktop/android/android/node_modules/metro/src/DeltaBundler/traverseDependencies.js:376:19)
    at Array.map (<anonymous>)
    at resolveDependencies (/Users/ios/Desktop/android/android/node_modules/metro/src/DeltaBundler/traverseDependencies.js:374:16)
    at /Users/ios/Desktop/android/android/node_modules/metro/src/DeltaBundler/traverseDependencies.js:212:33
    at Generator.next (<anonymous>)
    at step (/Users/ios/Desktop/android/android/node_modules/metro/src/DeltaBundler/traverseDependencies.js:297:313)
    at /Users/ios/Desktop/android/android/node_modules/metro/src/DeltaBundler/traverseDependencies.js:297:473
    at <anonymous>

1 个答案:

答案 0 :(得分:1)

您最近升级了本机吗?如果是,那可能就是问题所在。

如果没有,请检查node_modules文件夹中的文件。

如果没有任何效果,请尝试以下操作: 删除node_modules文件夹,然后关闭打包程序。 然后从您的项目目录中使用命令npm install重新安装。