Next.js: The gRPC binary module was not installed. This may be fixed by running "npm rebuild"

Created on 9 Jul 2019  路  7Comments  路  Source: vercel/next.js

Bug report

Describe the bug

Hello, I'm getting this error trying run yarn build. I want to deploy to now.sh my ssr app with firebase and antd. I tried npm i && npm rebuild && npm run build but it didn't work.

Solutions to another issues have not working.

gitpod /workspace/shopping $ yarn build
yarn run v1.16.0
warning package.json: No license field
$ next build
Creating an optimized production build ...

Using external babel configuration
Location: "/workspace/shopping/.babelrc"
Compiled with warnings.

./node_modules/bytebuffer/dist/bytebuffer-node.js
Module not found: Can't resolve 'memcpy' in '/workspace/shopping/node_modules/bytebuffer/dist'

Build error occurred
{ Error: The gRPC binary module was not installed. This may be fixed by running "npm rebuild"
Original error: Cannot find module './assets/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node'
at Object.L/Cg (/workspace/shopping/.next/serverless/pages/index.js:48582:17)
at __webpack_require__ (/workspace/shopping/.next/serverless/pages/index.js:23:31)
at Object.7noQ (/workspace/shopping/.next/serverless/pages/index.js:7759:12)
at __webpack_require__ (/workspace/shopping/.next/serverless/pages/index.js:23:31)
at Object.cJE4 (/workspace/shopping/.next/serverless/pages/index.js:62556:27)
at __webpack_require__ (/workspace/shopping/.next/serverless/pages/index.js:23:31)
at Object.z77n (/workspace/shopping/.next/serverless/pages/index.js:75069:14)
at __webpack_require__ (/workspace/shopping/.next/serverless/pages/index.js:23:31)
at Object.BYZf (/workspace/shopping/.next/serverless/pages/index.js:12181:12)
at __webpack_require__ (/workspace/shopping/.next/serverless/pages/index.js:23:31) code: 'MODULE_NOT_FOUND' }
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Clone this repo
  2. yarn && yarn build
  3. See error

System information

  • OS: [e.g. Linux]
  • Version of Next.js: 9.0.0
  • Node v10.15.3

Most helpful comment

I am having similar issue with latest next.js I get following error when building

Build error occurred
{ Error: Failed to load D:\Our-Projects\nepal-photo-tours\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown\grpc_node.node. Module did not self-register.

All 7 comments

I am having similar issue with latest next.js I get following error when building

Build error occurred
{ Error: Failed to load D:\Our-Projects\nepal-photo-tours\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown\grpc_node.node. Module did not self-register.

Do you use yarn? If so, try yarn install --force.

@danoc it's same. Recompile of packages does'nt help.

@Timer I've tried the canary version and set target to "experimental-serverless-trace" but I still get this error

Build error occurred
{ Error: Failed to load /Users/me/myproject/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node. Module did not self-register.
at Object.Module._extensions..node (internal/modules/cjs/loader.js:718:18)

Did you expect this to be resolved or could it be unrelated?

@0x80 please open a new issue with a full reproduction and we can take a look.

@Timer It seems very hard to isolate the problem. I started out with a bare simple starter repo, adding code and dependencies and matching configs, but everything kept working.

When I ran out of ideas I went the other way around, starting from my full app and cutting away things. Then I discovered something very strange. Say in my pages directory I have pages A,B,C,D,E,F. It appears that if I remove either one of them, my app builds without error. But if I try to build with all pages the error returns. It's also not a question of odd/even because if I just duplicate one page like A,A*,B,C,D,E,F I still get the error.

I was hoping you can give me a clue since you understand the build process. To me this is super weird behaviour and I don't know that to try next...

@yalamber Since you had the same error as me, maybe you can also try to build your app with canary and the new target setting. You might have more luck then me 馃槃

My issue was resolved with this PR which is part of canary.3. Glad I didn't spend more time chasing this, because I wouldn't have never found the cause.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

renatorib picture renatorib  路  3Comments

kenji4569 picture kenji4569  路  3Comments

DvirSh picture DvirSh  路  3Comments

jesselee34 picture jesselee34  路  3Comments

timneutkens picture timneutkens  路  3Comments