grpc: Cannot find module grpc_node.node

$ npm install google-cloud

Run node app…

Error:

2016-12-03T19:23:07.361Z - error: uncaughtException: Cannot find module '/opt/app/node_modules/google-cloud/node_modules/grpc/src/node/extension_binary/grpc_node.$ Error: Cannot find module ‘/opt/app/node_modules/google-cloud/node_modules/grpc/src/node/extension_binary/grpc_node.node’ at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (/opt/app/node_modules/google-cloud/node_modules/grpc/src/node/src/grpc_extension.js:38:15) at Module._compile (module.js:409:26) at Object.Module._extensions…js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17)

$ ls /opt/app/node_modules/google-cloud/node_modules/grpc/src/node
ext  index.js  README.md  src

Environment: Linux Debian 3.16.7

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 11
  • Comments: 20 (5 by maintainers)

Commits related to this issue

Most upvoted comments

It might help to add RUN npm rebuild after the npm install line.

@vasiliyb npm rebuild grpc helped in my case, had same issue within docker basically stated by @murgatroid99, but npm rebuild rebuilds all modules, I guess rebuilding only grpc is enough

npm rebuild grpc --force did the trick for me.

Node v9.4.0 npm v5.6.0

npm install --unsafe-perm worked for my use case.

Running npm rebuild after npm install resolved the issue for me

this fixed it: npm install --unsafe-perm

@vasiliyb I have the same problem with you Here is how i fix it. In Dockerfile, add

FROM node:latest
USER root

Also add .dockerignore same level as package.json in .dockerignore, just add one line

node_modules