node.js - Jenkins 构建失败 - 错误 : not found: make

标签 node.js jenkins npm jenkins-pipeline npm-install

我尝试为我的 npm 模块创建 CI,但我遇到了 NPM 安装命令的问题。我尝试全局安装 gyp 但对我没有任何作用。是依赖关系问题(package.json 文件是在控制台输出后添加的)还是缺少 jenkins 上的某些配置? Node 版本为 11.6.0

控制台输出:

gyp ERR! build error 
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/current_node/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack     at F (/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/current_node/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack     at E (/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/current_node/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/current_node/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/current_node/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/current_node/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:160:21)
gyp ERR! System Linux 4.9.0-8-amd64
gyp ERR! command "/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/current_node/bin/node" "/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/current_node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/jenkins_home/workspace/defined-id/defined-id/node_modules/bufferutil
gyp ERR! node -v v11.6.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN defined-id@1.0.0 No description
npm WARN The package js-sha256 is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bufferutil@3.0.5 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bufferutil@3.0.5 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /var/jenkins_home/.npm/_logs/2019-03-19T08_59_17_472Z-debug.log
Build step 'Execute shell' marked build as failure
Finished: FAILURE

包.json

{
    "name": "defined-id",
    "version": "1.0.0",
    "description": "",
    "main": "lib/index.js",
    "types": "lib/index.d.ts",
    "scripts": {
        "test": "jest --config jestconfig.json",
        "build": "tsc",
        "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
        "lint": "tslint -p tsconfig.json",
        "prepare": "yarn run build",
        "prepublishOnly": "yarn test && yarn run lint",
        "preversion": "yarn run lint",
        "version": "yarn run format && git add -A src",
        "postversion": "git push && git push --tags"
    },
    "repository": {
        "type": "git"
    },
    "author": "Geens NPO",
    "license": "ISC",
    "devDependencies": {
        "@types/jest": "^23.3.9",
        "jest": "^23.6.0",
        "js-sha256": "^0.9.0",
        "prettier": "^1.15.2",
        "ts-jest": "^23.10.5",
        "ts-node": "^8.0.3",
        "tslint": "^5.11.0",
        "tslint-config-prettier": "^1.16.0",
        "typescript": "^3.1.6"
    },
    "dependencies": {
        "@types/node": "^10.12.18",
        "@types/uuid": "^3.4.4",
        "base-58": "0.0.1",
        "base58check": "^2.0.0",
        "create-hmac": "^1.1.7",
        "js-sha256": "^0.9.0",
        "jsonld": "^1.4.0",
        "key-encoder": "^1.1.7",
        "nem2-sdk": "0.10.2",
        "ripemd160": "^2.0.2",
        "tweetnacl": "^1.0.1",
        "tweetnacl-util": "^0.15.0"
    }
}

执行外壳:

npm install --prefix defined-id
npm run build --prefix defined-id
npm run test --prefix defined-id

最佳答案

我怀疑这不是 Jenkins 错误。

在执行NPM命令的Linux中执行下面一行:

sudo apt-get install build-essential

并重新构建您的 Jenkins 作业。

关于node.js - Jenkins 构建失败 - 错误 : not found: make,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55250406/

相关文章:

javascript - 无法在 ec2 上初始化 Node.js

node.js - 为什么后续的 HTTP 请求

unit-testing - Ava 单独的集成和单元测试

node.js - npm 抛出错误 "Cannot find module ' 可读流'”

node.js - 如何在 apache 服务器中运行 nodejs 应用程序

node.js - 抓取 Netflix

java - 如何直接从 Jenkins 启动 Chrome 浏览器而不是在 Eclipse 中使用代码

docker - 如何在 docker 容器中使用 Jenkins 工具安装?

git - Jenkins 稀疏 checkout : only content of directory

npm - @nuxt/content 页面在生产模式下找不到