我尝试安装并运行AmpProject GitHub存储库上的amp-paywall-demo
示例失败:https://github.com/ampproject/samples/tree/master/amp-paywall-demo
我已经在那儿举了个Issue票,但到目前为止没有收到任何回复(https://github.com/ampproject/samples/issues/211)
我尝试按照安装指南进行操作:我克隆了存储库(按预期工作),随后是npm install
,不幸的是失败了。
我尝试自己调试错误,但未能成功。 我还搜索了该错误,并在Git存储库中的“问题”中搜索了类似的问题,但这也无济于事。
我创建了带有错误输出以及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"
}
}
非常感谢, 拉斐尔
答案 0 :(得分:2)
发生错误的原因是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年历史,并且已经deprecated。
grpc@0.14.1
要求的gcloud
的最新版本是1.18.0。
我还想知道为什么安装程序尝试安装名为node-pre-gyp的文件,但未在package.json中列出
node-pre-gyp
用于从二进制文件安装软件包的C ++模块。在您的情况下,它将自动用于安装C ++ gprc
软件包,以便可以在NodeJs上下文中使用它。
答案 1 :(得分:0)
您可以尝试以下命令
nvm install --lts
nvm use --lts
rm -rf node_modules && rm package-lock.json
npm install .