Home
Support Forums

Migrating NextJS from Vercel — Issues Deploying

My first build keeps failing, and I can’t seem to figure out why. I’ve researched everywhere. Here are the logs:

Error message
1:32:14 PM:   Error while installing dependencies in /opt/build/repo/.netlify/plugins/
1:32:14 PM:   npm WARN optional dep failed, continuing fsevents@2.3.2
1:32:14 PM: ​
1:32:14 PM:   > node-addon-api@3.2.1 install /opt/build/repo/.netlify/plugins/node_modules/@netlify/plugin-nextjs/node_modules/sharp/node_modules/node-addon-api
1:32:14 PM:   > node-gyp rebuild
1:32:14 PM: ​
1:32:14 PM:   (node:1592) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
1:32:14 PM:   (Use `node --trace-deprecation ...` to show where the warning was created)
1:32:14 PM:   gyp: binding.gyp not found (cwd: /opt/build/repo/.netlify/plugins/node_modules/@netlify/plugin-nextjs/node_modules/sharp/node_modules/node-addon-api) while trying to load binding.gyp
1:32:14 PM:   gyp ERR! configure error
1:32:14 PM:   gyp ERR! stack Error: `gyp` failed with exit code: 1
1:32:14 PM:   gyp ERR! stack     at ChildProcess.onCpExit (/opt/build/repo/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
1:32:14 PM:   gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
1:32:14 PM:   gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
1:32:14 PM:   gyp ERR! System Linux 4.19.167+
1:32:14 PM:   gyp ERR! command "/opt/build/repo/node_modules/node/bin/node" "/opt/build/repo/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
1:32:14 PM:   gyp ERR! cwd /opt/build/repo/.netlify/plugins/node_modules/@netlify/plugin-nextjs/node_modules/sharp/node_modules/node-addon-api
1:32:14 PM:   gyp ERR! node -v v16.5.0
1:32:14 PM:   gyp ERR! node-gyp -v v3.6.0
1:32:14 PM:   gyp ERR! not ok

My repo runs perfectly locally and on Vercel, and node-gyp rebuild also throws no errors locally, so I think it’s related to the setup within Netlify.

Any thoughts?

I also created an issue on Github with a little bit more context! gyp: binding.gyp not found while trying to load binding.gyp · Issue #1028 · nodejs/node-addon-api · GitHub