I failed trying to install and run the amp-paywall-demo
example available at the AmpProject GitHub repo: https://github.com/ampproject/samples/tree/master/amp-paywall-demo
I already raised an Issue ticket there, but received no response so far (https://github.com/ampproject/samples/issues/211)
I tried to follow the installation guide: I cloned the repository (this worked as expected), followed by npm install
which unfortunately failed.
I tried to debug the error myself but was unable to do so. I also googled the error, and searched for similar problems among the Issues in the Git repo, but that did not help either.
I created public gists with the output of the error, as well as the debug.log file
debug: https://gist.github.com/rafaelmarques7/707f1932f63cd042cdf1e6952c1093ab
The error stack is as follows:
ā 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
I am also wondering why the installation is trying to install something called node-pre-gyp
, which is not listed in the 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"
}
}
Much appreciated, Rafael
The reason for your error is that the version of the grpc
package (0.14.1) is not compatible to the NodeJs version (10.15.1) you are using:
Pre-built binaries not found for grpc@0.14.1 and node@10.15.1
You could try using an older version of NodeJs and see if that helps. But probably it's better if you try using more up-to-date dependencies - gcloud@^0.37.0
is ~ 2 years old and already deprecated.
The latest version of grpc@0.14.1
, which is required by gcloud
, is 1.18.0.
I am also wondering why the installation is trying to install something called node-pre-gyp, which is not listed in the package.json
node-pre-gyp
is used to install a packages' C++ modules from binaries. In your case it is automatically used to install the C++ gprc
package, so that you can use it in NodeJs context.