2

我尝试安装和运行amp-paywall-demoAmpProject GitHub 存储库中提供的示例失败:https ://github.com/ampproject/samples/tree/master/amp-paywall-demo 我已经在那里提出了问题票,但没有收到任何回复远(https://github.com/ampproject/samples/issues/211

我尝试遵循安装指南:我克隆了存储库(这按预期工作),随后npm install不幸失败了。

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

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

调试:https ://gist.github.com/rafaelmarques7/707f1932f63cd042cdf1e6952c1093ab

错误堆栈如下:

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

> grpc@0.14.1 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 node-pre-gyp@0.6.28
node-pre-gyp info using node@10.15.1 | 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 grpc@0.14.1 and node@10.15.1 (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 grpc@0.14.1 and node@10.15.1 (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 amp-publisher@0.0.1 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@0.14.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the grpc@0.14.1 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"
  }
}

非常感谢,拉斐尔

4

2 回答 2

4

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

Pre-built binaries not found for grpc@0.14.1 and node@10.15.1

您可以尝试使用旧版本的 NodeJ,看看是否有帮助。但是,如果您尝试使用更多最新的依赖项可能会更好 -gcloud@^0.37.0大约 2 岁并且已经弃用。所需
的 最新版本是 1.18.0。grpc@0.14.1gcloud

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

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

于 2019-02-15T10:20:52.900 回答
0

你可以试试这些命令

nvm install --lts
nvm use --lts
rm -rf node_modules && rm package-lock.json
npm install .
于 2019-07-18T23:06:29.403 回答