【问题标题】:build failed: exit code 127构建失败:退出代码 127
【发布时间】:2019-05-02 22:01:24
【问题描述】:

用我的应用创建了我的项目

这是 project.json 文件。我创建的

{
  "name": "detox",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "ios": "react-native run-ios",
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "test:e2e":"navicotrackapp test",
    "test:e2e:build":"navicotrackapp build"

  },
  "dependencies": {
    "react": "16.6.1",
    "react-native": "0.57.7"
  },
  "devDependencies": {
    "babel-jest": "23.6.0",
    "jest": "23.6.0",
    "metro-react-native-babel-preset": "0.49.2",
    "react-test-renderer": "16.6.1"
  },
  "jest": {
    "preset": "react-native"
  },
  "detox": {
    "configurations": {
      "ios.sim.debug": {
        "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/navicotrackapp.app",
        "build": "xcodebuild -project ios/navicotrackapp.xcodeproj -scheme navicotrackapp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
        "type": "ios.simulator",
        "name": "iPhone XR"
      }
    }
  }
}

但是。当我运行测试时,结果如下:

问题:

  1. 我做错了什么
  2. 如何解决?

【问题讨论】:

    标签: reactjs detox


    【解决方案1】:

    用这些替换您的 scripts 值,然后重试:

    "scripts": {
        "ios": "react-native run-ios",
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest",
        "test:e2e":"npm run test",
        "test:e2e:build":"npm run build"  // THIS SCRIPT WILL STILL BREAK FOR YOU
    },
    

    最后两个是重要的!

    如果脚本引用了package.json 中的另一个脚本,则需要在脚本命令前加上npm runyarn

    所以不是调用navicotrackapp test 的脚本,而是调用npm run testyarn test


    注意:

    在您的示例中,终端似乎在脚本 navicotrackapp build 上失败。知道您没有定义build 脚本,因此如果您将脚本替换为npm run build,它仍然会失败。如果你想让它工作,你需要添加一个build 脚本!

    "scripts": {
        "ios": "react-native run-ios",
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest",
        "build": // DO SOMETHING HERE!!!!,
        "test:e2e":"npm run test",
        "test:e2e:build":"npm run build"
    },
    

    【讨论】:

    • 谢谢哥们。我对使用 ios 做出原生反应是完全陌生的。你是个传奇。
    【解决方案2】:

    试试下面对我有用的命令

    • $ npm install @ionic/app-scripts@latest --save-dev

    • $ ionic serve

    【讨论】:

      【解决方案3】:

      只需使用https://app.netlify.com/dropNetlify 上手动部署

      首先运行这个命令

      npm run build 
      OR 
      yarn run build
      

      然后将build文件夹拖放到上面的网站上。

      【讨论】:

        【解决方案4】:

        试试这个,请注意空格。

        但它对我有用。我在npm run build 之前在大写字母中添加了CI=。仔细检查你是否做了 git add。 、git commit -m "first commit"git push -u origin 在最终部署之前。

        【讨论】:

          【解决方案5】:

          对于那些遇到yarn 127 错误代码问题的人

          看看https://github.com/reactstrap/reactstrap/issues/711 很可能您只需要在控制台yarn 中运行 :)

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2022-01-15
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2012-03-24
            • 1970-01-01
            • 1970-01-01
            • 2021-02-18
            相关资源
            最近更新 更多