由于可能与节点冲突而导致node-pre-gyp安装错误

问题描述 投票:0回答:1

我没有尝试安装和运行在AmpProject GitHub回购中提供的amp-paywall-demo示例:https://github.com/ampproject/samples/tree/master/amp-paywall-demo我已经在那里提出了一个发行票,但到目前为止没有收到回复(https://github.com/ampproject/samples/issues/211

我试着按照安装指南:我克隆了存储库(这按预期工作),然后是npm install,不幸的是失败了。

我试图自己调试错误,但无法这样做。我也搜索了错误,并在Git仓库中的问题中搜索了类似的问题,但这也没有帮助。

我使用错误的输出以及debug.log文件创建了公共要点

debug:https://gist.github.com/rafaelmarques7/707f1932f63cd042cdf1e6952c1093ab

错误堆栈如下:

➜  amp-paywall-demo git:(master) ✗ sudo npm i

> [email protected] install /home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcl
oud/node_modules/grpc
> node-pre-gyp install --fallback-to-build

node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ '/usr/bin/node',
node-pre-gyp verb cli   '/home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/
gcloud/node_modules/grpc/node_modules/.bin/node-pre-gyp',
node-pre-gyp verb cli   'install',
node-pre-gyp verb cli   '--fallback-to-build' ]
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
node-pre-gyp verb command install []
node-pre-gyp info check checked for "/home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/n
ode_modules/gcloud/node_modules/grpc/src/node/extension_binary/grpc_node.node" (not found)
node-pre-gyp http GET https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v0.14.1/no
de-v64-linux-x64.tar.gz
node-pre-gyp http 403 https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v0.14.1/no
de-v64-linux-x64.tar.gz
node-pre-gyp ERR! Tried to download: https://storage.googleapis.com/grpc-precompiled-binaries/node/
grpc/v0.14.1/node-v64-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (fal
ling back to source compile with node-gyp) 
node-pre-gyp http 403 status code downloading tarball https://storage.googleapis.com/grpc-precompil
ed-binaries/node/grpc/v0.14.1/node-v64-linux-x64.tar.gz 
node-pre-gyp verb command build [ 'rebuild' ]
node-pre-gyp ERR! Tried to download: https://storage.googleapis.com/grpc-precompiled-binaries/node/
grpc/v0.14.1/node-v64-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (fal
ling back to source compile with node-gyp) 
node-pre-gyp http Connection closed while downloading tarball file 
node-pre-gyp verb command build [ 'rebuild' ]
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/rafael/proj/tuts/amp-publisher-sample
/amp-paywall-demo/node_modules/gcloud/node_modules/grpc/build'
gyp ERR! System Linux 4.15.0-45-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcloud/node_modules/grpc/src/node/extension_binary/grpc_node.node" "--module_name=grpc_node" "--module_path=/home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcloud/node_modules/grpc/src/node/extension_binary"
gyp ERR! cwd /home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcloud/node_modules/grpc
gyp ERR! node -v v10.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcloud/node_modules/grpc/src/node/extension_binary/grpc_node.node --module_name=grpc_node --module_path=/home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcloud/node_modules/grpc/src/node/extension_binary' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcloud/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:970:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Linux 4.15.0-45-generic
node-pre-gyp ERR! command "/usr/bin/node" "/home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcloud/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcloud/node_modules/grpc
node-pre-gyp ERR! node -v v10.15.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.28
node-pre-gyp ERR! not ok 
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcloud/node_modules/grpc/src/node/extension_binary/grpc_node.node --module_name=grpc_node --module_path=/home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcloud/node_modules/grpc/src/node/extension_binary' (1)
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcloud/node_modules/grpc/build'
gyp ERR! System Linux 4.15.0-45-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcloud/node_modules/grpc/src/node/extension_binary/grpc_node.node" "--module_name=grpc_node" "--module_path=/home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcloud/node_modules/grpc/src/node/extension_binary"
gyp ERR! cwd /home/rafael/proj/tuts/amp-publisher-sample/amp-paywall-demo/node_modules/gcloud/node_modules/grpc
gyp ERR! node -v v10.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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/rafael/.npm/_logs/2019-02-15T09_29_56_863Z-debug.log

我也想知道为什么安装试图安装一个名为node-pre-gyp的东西,它没有在package.json中列出:

{
  "name": "amp-publisher",
  "version": "0.0.1",
  "description": "A sample implementation for an AMP Publisher",
  "main": "app.js",
  "engines": {
    "node": "^4.0.0"
  },
  "author": "The AMP HTML Authors",
  "license": "Apache-2.0",
  "scripts": {
    "start": "node app.js",
    "monitor": "nodemon app.js",
    "deploy": "gcloud preview app deploy app.yaml",
    "lint": "jshint --exclude-path=.gitignore .",
    "test": "npm run lint"
  },
  "dependencies": {
    "body-parser": "1.18.3",
    "cookie-parser": "1.4.3",
    "express": "4.16.4",
    "gcloud": "^0.37.0",
    "hogan-express": "0.5.2",
    "hogan.js": "^3.0.2",
    "jsonwebtoken": "^8.0.0",
    "uuid": "3.3.2"
  },
  "devDependencies": {
    "jshint": "2.9.7"
  }
}

非常感谢,拉斐尔

node.js npm amp-html node-pre-gyp
1个回答
2
投票

您输入错误的原因是grpc软件包(0.14.1)的版本与您使用的NodeJs版本(10.15.1)不兼容:

Pre-built binaries not found for [email protected] and [email protected]

您可以尝试使用旧版本的NodeJ,看看是否有帮助。但是如果你尝试使用更多的最新依赖项可能会更好 - gcloud@^0.37.0已经有2年了,而且已经是deprecated了。 [email protected]要求的gcloud的最新版本是1.18.0。

我也想知道为什么安装试图安装一个名为node-pre-gyp的东西,它没有在package.json中列出

node-pre-gyp用于从二进制文件安装软件包的C ++模块。在您的情况下,它会自动用于安装C ++ gprc包,以便您可以在NodeJs上下文中使用它。


0
投票

你可以尝试这些命令

nvm install --lts
nvm use --lts
rm -rf node_modules && rm package-lock.json
npm install .
© www.soinside.com 2019 - 2024. All rights reserved.