gpt4 book ai didi

react-native - 无法解析模块 `./index`

转载 作者:行者123 更新时间:2023-12-03 21:19:56 24 4
gpt4 key购买 nike

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

过去几天我一直收到此错误,并且在我运行“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

几个小时前已经发布了一个修复程序。请升级到 react-native 0.59.2 .

react-native upgrade

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

关于react-native - 无法解析模块 `./index`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55330641/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com