React Native---Error: Unable to resolve module `./index.android` from ``:None of these file
一、问题:新建一个工程后,在执行react-native start 后访问:http://localhost:8081/index.android.bundle?platform=android报错:Error: Unable to resolve module `./index.android` from `D:\DevelopTools\ReactNativeProjects\FirstPr
·
一、问题:
新建一个工程后,在执行react-native start 后访问:http://localhost:8081/index.android.bundle?platform=android
报错:
Error: Unable to resolve module `./index.android` from `D:\DevelopTools\ReactNativeProjects\FirstProject/.`: The module `./index.android` could not be found from `D:\DevelopTools\ReactNativeProjects\FirstProject/.`. Indeed, none of these files exist: * `D:\DevelopTools\ReactNativeProjects\FirstProject\index.android(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)` * `D:\DevelopTools\ReactNativeProjects\FirstProject\index.android\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 (D:\DevelopTools\ReactNativeProjects\FirstProject\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:163:15) at ResolutionRequest.resolveDependency (D:\DevelopTools\ReactNativeProjects\FirstProject\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18) at DependencyGraph.resolveDependency (D:\DevelopTools\ReactNativeProjects\FirstProject\node_modules\metro\src\node-haste\DependencyGraph.js:283:16) at D:\DevelopTools\ReactNativeProjects\FirstProject\node_modules\metro\src\lib\transformHelpers.js:264:42 at Server.<anonymous> (D:\DevelopTools\ReactNativeProjects\FirstProject\node_modules\metro\src\Server.js:1049:41) at Generator.next (<anonymous>) at asyncGeneratorStep (D:\DevelopTools\ReactNativeProjects\FirstProject\node_modules\metro\src\Server.js:99:24) at _next (D:\DevelopTools\ReactNativeProjects\FirstProject\node_modules\metro\src\Server.js:119:9)
二、解决:
是react native版本更新的一些变动。原来工程中会创建:index.ios.js 和index.android.js,现在只会创建index.js。一个简单的规避方法,就是copy 一份index.js 文件命名为index.android.js即可
更多推荐
已为社区贡献8条内容
所有评论(0)