[0.59.1]react-native run-android出错



  • @晴明

    先用npm start起packager,再run-android(如果你之前已经编译好了,直接在设备上点应用图标即可,不需要run-android)

    会在0.59.2版本中修复(可能今晚或者明天发布)mac平台的问题,windows平台的需要等到0.59.3


    Looking for JS files in
    D:\Projects\Temp\TestApp\node_modules\react-native\scripts

    Loading dependency graph, done.
    Error: Unable to resolve module ./index from D:\Projects\Temp\TestApp\node_mo dules\react-native\scripts/.: The module ./index could not be found from D:\ Projects\Temp\TestApp\node_modules\react-native\scripts/.. Indeed, none of thes
    e files exist:

    • D:\Projects\Temp\TestApp\node_modules\react-native\scripts\index(.native||. android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.t s|.ts|.android.tsx|.native.tsx|.tsx)
    • D:\Projects\Temp\TestApp\node_modules\react-native\scripts\index\index(.nat ive||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.na tive.ts|.ts|.android.tsx|.native.tsx|.tsx)
      at ModuleResolver.resolveDependency (D:\Projects\Temp\TestApp\node_modules\m
      etro\src\node-haste\DependencyGraph\ModuleResolution.js:163:15)
      at ResolutionRequest.resolveDependency (D:\Projects\Temp\TestApp\node_module
      s\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:52:18)
      at DependencyGraph.resolveDependency (D:\Projects\Temp\TestApp\node_modules
      metro\src\node-haste\DependencyGraph.js:283:16)
      at D:\Projects\Temp\TestApp\node_modules\metro\src\lib\transformHelpers.js:2
      61:42
      at Server.<anonymous> (D:\Projects\Temp\TestApp\node_modules\metro\src\Serve
      r.js:1038:41)
      at Generator.next (<anonymous>)
      at asyncGeneratorStep (D:\Projects\Temp\TestApp\node_modules\metro\src\Serve
      r.js:99:24)
      at _next (D:\Projects\Temp\TestApp\node_modules\metro\src\Server.js:119:9)
      ::ffff:127.0.0.1 - - [23/Mar/2019:15:19:02 +0000] "GET /index.delta?platform=and
      roid&dev=true&minify=false HTTP/1.1" 500 - "-" "okhttp/3.12.1"
      package.json:

    {
    "name": "TestApp",
    "version": "0.0.1",
    "private": true,
    "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "lint": "eslint ."
    },
    "dependencies": {
    "react": "16.8.3",
    "react-native": "0.59.1"
    },
    "devDependencies": {
    "@babel/core": "^7.4.0",
    "@babel/runtime": "^7.4.2",
    "@react-native-community/eslint-config": "^0.0.3",
    "babel-jest": "^24.5.0",
    "eslint": "^5.15.3",
    "jest": "^24.5.0",
    "metro-react-native-babel-preset": "^0.53.1",
    "react-test-renderer": "16.8.3"
    },
    "jest": {
    "preset": "react-native"
    }
    }
    请帮忙解决



  • 同样问题,昨天还好好的,今天运行和你的一样,排查了几个小时,无果



  • 看起来是个bug,待官方确认
    暂时的解决方案:
    先用
    npm start起packager,再run-android(如果你之前已经编译好了,直接在设备上点应用图标即可,不需要run-android)



  • 新版本发布没几天,按照惯例肯定会有很多问题的啦!后面的坑还有很多,建议你用0.58.6



  • 在命令行运行
    react-native start -- --reset-cache
    然后
    react-native run-android 在另一个命令行
    我成功了
    https://github.com/facebook/react-native/issues/23908



  • mac会在0.59.2修复, windows会在0.59.3修复



  • @zhengdahan 感谢,好了



  • @晴明 终于解决了,我把android中build文件删除,之后再次使用可以了


Log in to reply