繁体   English   中英

VueJS 项目的“npm install”错误“node-pre-gyp install”

[英]Error "node-pre-gyp install" on "npm install" of a VueJS project

当我在从 Git 克隆的 VueJS 项目中运行npm install ,我看到了很多错误。 分析它我知道错误与以下命令有关: node-pre-gyp install --fallback-to-build --library=static_library 所以我尝试只执行它并得到以下错误:

augusto.cadini@CTNLDELL3G0FPZ2:~/Documents/particular/quinta-app$ node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.6.32
node-pre-gyp info using node@8.10.0 | linux | x64
node-pre-gyp info build requesting source compile
gyp info it worked if it ends with ok
gyp info using node-gyp@6.1.0
gyp info using node@12.14.1 | linux | x64
gyp info ok 
node-pre-gyp ERR! UNCAUGHT EXCEPTION 
node-pre-gyp ERR! stack Error: quinta-app package.json is not node-pre-gyp ready:
node-pre-gyp ERR! stack package.json must declare these properties: 
node-pre-gyp ERR! stack main
node-pre-gyp ERR! stack binary.module_name
node-pre-gyp ERR! stack binary.module_path
node-pre-gyp ERR! stack binary.host
node-pre-gyp ERR! stack     at validate_config (/usr/lib/nodejs/node-pre-gyp/lib/util/versioning.js:203:15)
node-pre-gyp ERR! stack     at Object.module.exports.evaluate (/usr/lib/nodejs/node-pre-gyp/lib/util/versioning.js:261:5)
node-pre-gyp ERR! stack     at handle_gyp_opts (/usr/lib/nodejs/node-pre-gyp/lib/util/handle_gyp_opts.js:54:27)
node-pre-gyp ERR! stack     at configure (/usr/lib/nodejs/node-pre-gyp/lib/configure.js:11:5)
node-pre-gyp ERR! stack     at /usr/lib/nodejs/node-pre-gyp/lib/build.js:35:13
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/lib/nodejs/node-pre-gyp/lib/util/compile.js:85:9)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 4.15.0-1030-oem
node-pre-gyp ERR! command "/usr/bin/node" "/usr/bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /home/augusto.cadini/Documents/particular/quinta-app
node-pre-gyp ERR! node -v v8.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.32
node-pre-gyp ERR! This is a bug in `node-pre-gyp`.
node-pre-gyp ERR! Try to update node-pre-gyp and file an issue if it does not help:
node-pre-gyp ERR!     <https://github.com/mapbox/node-pre-gyp/issues>

这告诉我错误在package.json ,但另一个开发npm install工作正常。

包.json

{
  "name": "quinta-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^3.4.4",
    "firebase": "^7.6.2",
    "vue": "^2.6.10",
    "vue-router": "^3.1.4",
    "vuetify": "^2.2.3",
    "vuex": "^3.1.2"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^4.1.0",
    "@vue/cli-plugin-eslint": "^4.1.0",
    "@vue/cli-service": "^4.1.0",
    "babel-eslint": "^10.0.3",
    "eslint": "^5.16.0",
    "eslint-plugin-vue": "^5.0.0",
    "sass": "^1.19.0",
    "sass-loader": "^8.0.0",
    "vue-cli-plugin-vuetify": "^2.0.3",
    "vue-template-compiler": "^2.6.10",
    "vuetify-loader": "^1.3.0"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "rules": {
      "no-unused-vars": "off",
      "no-console": "off"
    },
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions"
  ]
}

完成 npm 安装错误

augusto.cadini@CTNLDELL3G0FPZ2:~/Documents/particular/quinta-app$ npm install

> grpc@1.24.2 install /home/augusto.cadini/Documents/particular/quinta-app/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp WARN Pre-built binaries not installable for grpc@1.24.2 and node@12.14.1 (node-v72 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error ENOENT: no such file or directory, open '/path/to/your/cert.pem' 
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: ENOENT: no such file or directory, open '/path/to/your/cert.pem'
gyp ERR! stack     at Object.openSync (fs.js:440:3)
gyp ERR! stack     at Object.readFileSync (fs.js:342:35)
gyp ERR! stack     at readCAFile (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:437:15)
gyp ERR! stack     at download (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:409:22)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:162:19
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:30:20
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:146:23)
gyp ERR! System Linux 4.15.0-1030-oem
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=/home/augusto.cadini/Documents/particular/quinta-app/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/home/augusto.cadini/Documents/particular/quinta-app/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /home/augusto.cadini/Documents/particular/quinta-app/node_modules/grpc
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/home/augusto.cadini/Documents/particular/quinta-app/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/home/augusto.cadini/Documents/particular/quinta-app/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/augusto.cadini/Documents/particular/quinta-app/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:223:5)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Linux 4.15.0-1030-oem
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/augusto.cadini/Documents/particular/quinta-app/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /home/augusto.cadini/Documents/particular/quinta-app/node_modules/grpc
node-pre-gyp ERR! node -v v12.14.1
node-pre-gyp ERR! node-pre-gyp -v v0.14.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/home/augusto.cadini/Documents/particular/quinta-app/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/home/augusto.cadini/Documents/particular/quinta-app/node_modules/grpc/src/node/extension_binary/node-v72-linux-x64-glibc --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.24.2 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the grpc@1.24.2 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!     /home/augusto.cadini/.npm/_logs/2020-01-15T14_41_45_831Z-debug.log

使用以下步骤解决:

  1. 执行这些步骤: https : //docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
  2. npm config set strict-ssl false
  3. 设置您的证书: npm config set cafile /path/to/cert/my_cert.pem --global

在我的情况下,证书的路径是: npm config set cafile /etc/ssl/certs/Fortinet_CA_SSLProxy.pem --global

这发生在我身上,因为我安装了节点版本 12 而不是节点版本 10,并且一些包(firebase)期待节点 10。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM