小编Vyt*_*lis的帖子

Jest 无法从 node_modules 中找到模块

我正在创建打字稿基础 npm 模块,但我坚持玩笑测试。我正在尝试包含来自https://github.com/types/jsonld 的jsonld 模块,一切似乎都正常,但是当我运行命令时yarn test出现错误消息Cannot find module 'jsonld' from 'DidDocument.ts'

包.json

{
    "name": "defined-id",
    "version": "1.0.0",
    "description": "Defined ID",
    "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": { …
Run Code Online (Sandbox Code Playgroud)

types typescript json-ld jestjs

5
推荐指数
1
解决办法
1153
查看次数

Jenkins 构建失败 - 错误:未找到:make

我尝试为我的 npm 模块创建 CI,但 NPM 安装命令出现问题。我尝试全局安装 gyp 但对我来说没有任何作用。是否存在依赖关系问题(package.json 文件在控制台输出后添加)或 jenkins 上的某些配置丢失?节点版本是 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 …
Run Code Online (Sandbox Code Playgroud)

node.js npm jenkins npm-install jenkins-pipeline

2
推荐指数
1
解决办法
4669
查看次数