无法解析模块“./index”

2023-12-27

过去几天,我的代码中一直收到无法解析模块索引的消息,并找到了临时解决方案,但无法找到永久修复。

在过去的几天里,我一直收到此错误,并且当我运行“npm start -- --reset-cache”时找到了临时解决方案,但是每当我再次运行“react-native run-android”时,都会出现相同的错误弹出。这就是错误。

为什么会出现此错误?如何在不每次都使用临时解决方案的情况下解决该错误?

Error: Unable to resolve module `./index` from `c:\reactnative\a\node_modules\react-native\scripts/.`: The module `./index` could not be found from `c:\reactnative\a\node_modules\react-native\scripts/.`. Indeed, none of these files exist:
  * `c:\reactnative\a\node_modules\react-native\scripts\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
  * `c:\reactnative\a\node_modules\react-native\scripts\index\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
    at ModuleResolver.resolveDependency (c:\reactnative\a\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:163:15)
    at ResolutionRequest.resolveDependency (c:\reactnative\a\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (c:\reactnative\a\node_modules\metro\src\node-haste\DependencyGraph.js:283:16)
    at c:\reactnative\a\node_modules\metro\src\lib\transformHelpers.js:261:42
    at Server.<anonymous> (c:\reactnative\a\node_modules\metro\src\Server.js:1038:41)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (c:\reactnative\a\node_modules\metro\src\Server.js:99:24)
    at _next (c:\reactnative\a\node_modules\metro\src\Server.js:119:9)
::ffff:127.0.0.1 - - [25/Mar/2019:02:18:03 +0000] "GET /index.delta?platform=android&dev=true&minify=false HTTP/1.1" 500 - "-" "okhttp/3.12.1"

此问题是由于最新 React Native 版本中的错误引起的0.59: https://github.com/facebook/react-native/issues/24112 https://github.com/facebook/react-native/issues/24112

几个小时前发布了修复程序。请升级到react-native0.59.2.

react-native upgrade

有关如何升级的完整指南:https://facebook.github.io/react-native/docs/upgrading https://facebook.github.io/react-native/docs/upgrading

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法解析模块“./index” 的相关文章

随机推荐