node-gyp: node-pre-gyp build fail error while installing with `npm install` or `npm install -d`

  • Node Version: 11.0.0
  • NPM Version: 6.4.1
  • Platform: Darwin prabal-ADFGs-MacBook-Pro.local 17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64 x86_64
  • Compiler: Apple LLVM version 9.1.0 (clang-902.0.39.1) Target: x86_64-apple-darwin17.2.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
  • Module: npm install -d
Verbose output (from npm or node-gyp):
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
rm: ./Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o.d.raw: No such file or directory
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 17.2.0
gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/Users/Divyeshparmar/Documents/speakerswire-admin/node_modules/google-gax/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/Divyeshparmar/Documents/speakerswire-admin/node_modules/google-gax/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /Users/Divyeshparmar/Documents/speakerswire-admin/node_modules/google-gax/node_modules/grpc
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/11.0.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/Divyeshparmar/Documents/speakerswire-admin/node_modules/google-gax/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/Divyeshparmar/Documents/speakerswire-admin/node_modules/google-gax/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/Divyeshparmar/Documents/speakerswire-admin/node_modules/google-gax/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Darwin 17.2.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/Users/Divyeshparmar/Documents/speakerswire-admin/node_modules/google-gax/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /Users/Divyeshparmar/Documents/speakerswire-admin/node_modules/google-gax/node_modules/grpc
node-pre-gyp ERR! node -v v11.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/Cellar/node/11.0.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/Divyeshparmar/Documents/speakerswire-admin/node_modules/google-gax/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/Divyeshparmar/Documents/speakerswire-admin/node_modules/google-gax/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
npm info lifecycle grpc@1.16.0~install: Failed to exec install script
npm timing action:install Completed in 9072ms
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o
../deps/grpc/src/core/lib/backoff/backoff.cc:19:10: fatal error: 'grpc/support/port_platform.h' file not found
#include <grpc/support/port_platform.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.░⸩ ⠴ install: timing action:install Completed in 9072ms
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 17.2.0
gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/Users/Divyeshparmar/Documents/speakerswire-admin/node_modules/google-gax/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/Divyeshparmar/Documents/speakerswire-admin/node_modules/google-gax/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /Users/Divyeshparmar/Documents/speakerswire-admin/node_modules/google-gax/node_modules/grpc
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm timing stage:rollbackFailedOptional Completed in 471ms
npm timing stage:runTopLevelLifecycles Completed in 30557ms
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.16.0 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.16.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm timing npm Completed in 32016ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/Divyeshparmar/.npm/_logs/2018-11-06T06_26_21_408Z-debug.log

the repo has a server running with Express.js+Next.js and it is serving React-redux application. The repo’s readme.md says that it needs to be installed by running npm install -d but whenever I run it with it or npm install it just gives out following error

Please help me on how should I resolve it or where to look at for the same. Please help

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 41 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Thank you for suggesting that, the error got resolved by running

npm install --build-from-resource

as suggested by (@nicolasnoble)[https://github.com/nicolasnoble]

Thank you for suggesting that, the error got resolved by running

npm install --build-from-resource

as suggested by (@nicolasnoble)[https://github.com/nicolasnoble]

sudo npm install --unsafe-perm node-sass -g worked for me 😉

It didn’t still work. any other solution?

I actually had a few issues here on my own. Running Node 12.4.0. What I actually did that fixed it was 1.) npm install --build-from-resource 2.) npm install fsevents (in my case fsevents was part of the issue). Still not sure what the issue was.

If I continued having issues I would probably nuke the node_modules, install fresh, try to manually install whatever was causing the issues, then go back to install the whole package and see from there.

I had a very similar issue I had to remove both my yarn.lock file and node_modules directory. I tried removing just the node_modules directory but it did not work until after I also deleted the yarn.lock file.

This answer helped me. So I just downgraded node (with nvm) and it worked!

It didn’t still work. any other solution?

yes it does work @dreamhigh0822 !

Removing firebase dependency from package.json, followed by npm install --build-from-resource magically removes all errors. Makes me wonder why sometimes programmers should not question why things work and why not.

@cloudnine-testscript your error output suggests that you’re trying to compile an addon that hasn’t been updated to work on the version of Node.js that you’re using. You should either downgrade Node.js (maybe 10?), upgrade the version of the addon you’re using or, if that doesn’t work, chase up the addon author and ask them to update to work with the version of Node.js that you’re using.

@anthonybrown Your version of grpc (1.19.0) doesn’t support Node.js 12. You need at least grpc 1.20.2: https://github.com/grpc/grpc-node/releases/tag/grpc%401.20.2

@SamiChab Thank you. It helped me. I just downgraded node to 10, then it works well.

You can downgrade node version or upgrade firebase version. I think that firebase upgrade is good option.

I downgraded to Node 10.x and the issues were fixed (I have Mac OS Catalina)