皮特与詹金斯

时间:2017-03-14 03:19:38

标签: jenkins npm eslint

我有 package.json

{
  "name": "lahmacun",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "lint": "standard --verbose | snazzy",
    "lintdiff": "git diff --name-only --cached --relative | grep '\\.js$' | xargs standard | snazzy",
    "fixcode": "standard --fix",
    "clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean",
    "clean:android": "cd android/ && ./gradlew clean && cd .. && react-native run-android",
    "newclear": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules/ && npm cache clean && npm i",
    "test": "ava",
    "test:watch": "ava --watch",
    "coverage": "nyc ava && nyc report --reporter=html && open coverage/index.html || xdg-open coverage/index.html",
    "android:build": "cd android && ./gradlew assembleRelease",
    "android:install": "cd android && ./gradlew assembleRelease && ./gradlew installRelease",
    "android:hockeyapp": "cd android && ./gradlew assembleRelease && puck -submit=auto app/build/outputs/apk/app-release.apk",
    "android:devices": "$ANDROID_HOME/platform-tools/adb devices",
    "android:logcat": "$ANDROID_HOME/platform-tools/adb logcat *:S ReactNative:V ReactNativeJS:V",
    "android:shake": "$ANDROID_HOME/platform-tools/adb devices | grep '\\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} $ANDROID_HOME/platform-tools/adb -s {} shell input keyevent 82",
    "precommit": "npm run git-hook",
    "prepush": "npm run git-hook",
    "git-hook": "npm run lint -s && npm test -s"
  },
  "dependencies": {
    "apisauce": "^0.10.0",
    "format-json": "^1.0.3",
    "lodash": "^4.17.2",
    "querystringify": "0.0.4",
    "ramda": "^0.23.0",
    "react": "15.4.2",
    "react-native": "0.42.0",
    "react-native-animatable": "^1.1.0",
    "react-native-config": "^0.2.1",
    "react-native-device-info": "^0.10.0",
    "react-native-drawer": "^2.3.0",
    "react-native-i18n": "^1.0.0",
    "react-native-router-flux": "^3.37.0",
    "react-native-vector-icons": "^4.0.0",
    "react-navigation": "^1.0.0-beta.6",
    "react-redux": "^5.0.2",
    "redux": "^3.6.0",
    "redux-persist": "^4.1.0",
    "redux-saga": "^0.14.3",
    "reduxsauce": "0.4.1",
    "seamless-immutable": "^7.0.1"
  },
  "devDependencies": {
    "ava": "^0.18.2",
    "babel-eslint": "^7.1.1",
    "babel-preset-es2015": "^6.18.0",
    "enzyme": "^2.6.0",
    "husky": "^0.13.1",
    "ignite-animatable": "^0.3.1",
    "ignite-dev-screens": "^2.0.0-beta.1",
    "ignite-i18n": "^0.1.1",
    "ignite-ir-boilerplate-2016": "^0.2.0",
    "ignite-vector-icons": "^0.2.1",
    "mockery": "^2.0.0",
    "nyc": "^10.1.2",
    "react-addons-test-utils": "^15.3.1",
    "react-dom": "^15.4.0",
    "react-native-mock": "^0.3.1",
    "reactotron-apisauce": "^1.7.0",
    "reactotron-react-native": "^1.7.0",
    "reactotron-redux": "^1.7.0",
    "reactotron-redux-saga": "^1.7.0",
    "snazzy": "^6.0.0",
    "standard": "8.6.0"
  },
  "ava": {
    "files": [
      "Tests/**/*.js",
      "!Tests/Setup.js"
    ],
    "require": [
      "babel-register",
      "babel-polyfill",
      "react-native-mock/mock",
      "./Tests/Setup"
    ],
    "babel": "inherit"
  },
  "standard": {
    "parser": "babel-eslint",
    "globals": [
      "describe",
      "it",
      "fetch",
      "navigator",
      "__DEV__",
      "XMLHttpRequest",
      "FormData",
      "React$Element"
    ]
  },
  "config": {
    "ghooks": {
      "pre-commit": "if [ -d 'ignite-base' ]; then cd ignite-base; fi; npm run lint"
    }
  }
}

当我在本地运行以下命令时,它完全正常。

lint --xml test.xml *

但是在shell脚本npm install之后的Jenkins中,我在成功显示错误后收到此错误:

03:56:48 ✖ 115484 problems
03:56:48 
03:56:48 npm ERR! Linux 4.4.0-62-generic
03:56:48 npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "lint" "__tests__" "android" "app.json" "components" "data.js" "images" "index.android.js" "index.ios.js" "ios" "node_modules" "package.json" "react-native-packager-cache-4d9c2999" "reports" "yarn.lock"
03:56:48 npm ERR! node v7.7.2
03:56:48 npm ERR! npm  v4.1.2
03:56:48 npm ERR! code ELIFECYCLE
03:56:48 npm ERR! MyTest1@0.0.1 lint: `standard --verbose | snazzy "__tests__" "android" "app.json" "components" "data.js" "images" "index.android.js" "index.ios.js" "ios" "node_modules" "package.json" "react-native-packager-cache-4d9c2999" "reports" "yarn.lock"`
03:56:48 npm ERR! Exit status 1
03:56:48 npm ERR! 
03:56:48 npm ERR! Failed at the MyTest1@0.0.1 lint script 'standard --verbose | snazzy "__tests__" "android" "app.json" "components" "data.js" "images" "index.android.js" "index.ios.js" "ios" "node_modules" "package.json" "react-native-packager-cache-4d9c2999" "reports" "yarn.lock"'.
03:56:48 npm ERR! Make sure you have the latest version of node.js and npm installed.
03:56:48 npm ERR! If you do, this is most likely a problem with the MyTest1 package,
03:56:48 npm ERR! not with npm itself.
03:56:48 npm ERR! Tell the author that this fails on your system:
03:56:48 npm ERR!     standard --verbose | snazzy "__tests__" "android" "app.json" "components" "data.js" "images" "index.android.js" "index.ios.js" "ios" "node_modules" "package.json" "react-native-packager-cache-4d9c2999" "reports" "yarn.lock"
03:56:48 npm ERR! You can get information on how to open an issue for this project with:
03:56:48 npm ERR!     npm bugs MyTest1
03:56:48 npm ERR! Or if that isn't available, you can get their info via:
03:56:48 npm ERR!     npm owner ls MyTest1
03:56:48 npm ERR! There is likely additional logging output above.
03:56:48 
03:56:48 npm ERR! Please include the following file with any support request:
03:56:48 npm ERR!     /root/.jenkins/jobs/smayle/workspace/npm-debug.log
03:56:48 Build step 'Execute shell' marked build as failure
03:56:48 Finished: FAILURE

我在shell脚本中在Jenkins中所做的就是:

npm install
npm run lint *

0 个答案:

没有答案