构建失败:退出代码 127

fyp*_*nlp 6 reactjs detox

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

这是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"
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

然而。当我进行测试时,结果是这样的:

在此输入图像描述

问题:

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

Dan*_*cki 7

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

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


Mik*_*eln 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
},
Run Code Online (Sandbox Code Playgroud)

最后两条才是最重要的!

npm run如果yarn脚本引用了package.json.

因此,它不会调用脚本,而是navicotrackapp test调用npm run testOR yarn 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"
},
Run Code Online (Sandbox Code Playgroud)