构建失败:退出代码127

问题描述 投票:0回答:1

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

这是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"
      }
    }
  }
}

然而。当我运行测试时,这是出来的:

enter image description here

问题:

  1. 我做错了什么
  2. 我如何解决它?
reactjs detox
1个回答
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
},

最后两个是重要的!

如果脚本引用了npm run中的另一个脚本,则需要使用yarnpackage.json为脚本命令添加前缀。

所以,而不是一个调用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"
},
© www.soinside.com 2019 - 2024. All rights reserved.