React Native 错误:无法解析/Users/tandamangreen/Desktop/nbaCup/nbaClient/中的模块./索引,:

bwleehnv  于 2022-12-30  发布在  React
关注(0)|答案(1)|浏览(82)
Error: Unable to resolve module ./index from /Users/tandamangreen/Desktop/nbaCup/nbaClient/.: 

None of these files exist:
  * index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
  * index/index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
    at ModuleResolver.resolveDependency (/Users/tandamangreen/Desktop/nbaCup/nbaClient/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:136:15)
    at DependencyGraph.resolveDependency (/Users/tandamangreen/Desktop/nbaCup/nbaClient/node_modules/metro/src/node-haste/DependencyGraph.js:231:43)
    at /Users/tandamangreen/Desktop/nbaCup/nbaClient/node_modules/metro/src/lib/transformHelpers.js:129:24
    at Server._resolveRelativePath (/Users/tandamangreen/Desktop/nbaCup/nbaClient/node_modules/metro/src/Server.js:1107:12)
    at async Server.requestProcessor [as _processBundleRequest] (/Users/tandamangreen/Desktop/nbaCup/nbaClient/node_modules/metro/src/Server.js:450:37)
    at async Server._processRequest (/Users/tandamangreen/Desktop/nbaCup/nbaClient/node_modules/metro/src/Server.js:406:9)

我在src文件夹里有indexiderjs,它应该在顶层文件夹里。一旦我把它放在那里,我就没有问题了。

xuo3flqw

xuo3flqw1#

确保你的启动源文件被放置在正确的目录中,否则metro不知道在哪里可以找到它。

相关问题