Deploy fails on node-gyp-build command (migration from gatsby to netlify)

Hey there!

Sorry in advance, I’m not a developer myself and do not understand many things in terms deployment and building. I used gatsby cloud and it worked fine for me before. Now I am trying to migrate my website from gatsby cloud to netlify and can’t build a production build from my repo. I registered at netlify and connected my github repo to it, then triggered deployment and it failed on the build phase. More information is below.

Could you please tell me what I can do to solve it? I’ve tried to find similar issues but I barely understand what steps need to be taken to resolve that. Also, I navigated to Build troubleshooting tips | Netlify Docs to find a solution but I don’t quite understand the exact type of error I have and I am afraid to make things even worse. Thank you for your help!

9:08:00 AM: buildbot version: aae36d37bb0728ee6dc52d97c5e1b5b83720773e
9:08:00 AM: build-image version: 73f16e520fdddf409be6f578c8c2c8941bdf32d3 (focal)
9:08:00 AM: Starting to prepare the repo for build
9:08:00 AM: Building without cache
9:08:00 AM: git clone --filter=blob:none https://github.com/Averin-Vladislav/vladaverin.com
9:08:00 AM: No cached dependencies found. Cloning fresh repo
9:08:01 AM: Preparing Git Reference refs/heads/master
9:08:02 AM: Starting to install dependencies
9:08:02 AM: Python version set to 3.8
9:08:02 AM: Attempting Ruby version 2.7.2, read from environment
9:08:03 AM: Using Ruby version 2.7.2
9:08:03 AM: Started restoring cached go cache
9:08:03 AM: Finished restoring cached go cache
9:08:05 AM: Installing Go version 1.19.13 (requested 1.19.x)
9:08:09 AM: go version go1.19.13 linux/amd64
9:08:10 AM: Using PHP version 8.0
9:08:11 AM: Downloading and installing node v18.18.0...
9:08:11 AM: Downloading https://nodejs.org/dist/v18.18.0/node-v18.18.0-linux-x64.tar.xz...
9:08:11 AM: Computing checksum with sha256sum
9:08:11 AM: Checksums matched!
9:08:13 AM: Now using node v18.18.0 (npm v9.8.1)
9:08:13 AM: Enabling Node.js Corepack
9:08:13 AM: Started restoring cached build plugins
9:08:13 AM: Finished restoring cached build plugins
9:08:13 AM: Started restoring cached corepack dependencies
9:08:13 AM: Finished restoring cached corepack dependencies
9:08:13 AM: Started restoring cached yarn cache
9:08:13 AM: Finished restoring cached yarn cache
9:08:14 AM: No yarn workspaces detected
9:08:14 AM: Started restoring cached node modules
9:08:14 AM: Finished restoring cached node modules
9:08:14 AM: Installing npm packages using Yarn version 1.22.19
9:08:14 AM: yarn install v1.22.19
9:08:14 AM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
9:08:15 AM: [1/4] Resolving packages...
9:08:15 AM: [2/4] Fetching packages...
9:08:29 AM: [3/4] Linking dependencies...
9:08:29 AM: warning "gatsby > eslint-config-react-app@6.0.0" has unmet peer dependency "babel-eslint@^10.0.0".
9:08:29 AM: warning "gatsby > @typescript-eslint/eslint-plugin > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
9:08:29 AM: warning "gatsby > eslint-plugin-graphql > graphql-config > @endemolshinegroup/cosmiconfig-typescript-loader > ts-node@9.1.1" has unmet peer dependency "typescript@>=2.7".
9:08:29 AM: warning " > gatsby-plugin-gatsby-cloud@4.4.0" has unmet peer dependency "webpack@*".
9:08:29 AM: warning "gatsby-plugin-gatsby-cloud > webpack-assets-manifest@5.0.6" has unmet peer dependency "webpack@^5.2.0".
9:08:29 AM: warning " > gatsby-plugin-image@2.4.0" has unmet peer dependency "@babel/core@^7.12.3".
9:08:29 AM: warning " > gatsby-remark-images-anywhere@1.3.1" has incorrect peer dependency "gatsby@^2.12.0".
9:08:29 AM: warning " > gatsby-remark-images-anywhere@1.3.1" has incorrect peer dependency "gatsby-source-filesystem@^2.0.0".
9:08:29 AM: warning " > gatsby-remark-images-anywhere@1.3.1" has incorrect peer dependency "gatsby-plugin-sharp@^2.2.7".
9:08:36 AM: [4/4] Building fresh packages...
9:08:37 AM: warning Error running install script for optional dependency: "/opt/build/repo/node_modules/msgpackr-extract: Command failed.
Exit code: 1
9:08:37 AM: Command: node-gyp-build
9:08:37 AM: Arguments:
9:08:37 AM: Directory: /opt/build/repo/node_modules/msgpackr-extract
9:08:37 AM: Output:
9:08:37 AM: node:events:495
9:08:37 AM:       throw er; // Unhandled "error" event
9:08:37 AM:       ^
9:08:37 AM: Error: spawn node-gyp ENOENT
9:08:37 AM:     at ChildProcess._handle.onexit (node:internal/child_process:284:19)
9:08:37 AM:     at onErrorNT (node:internal/child_process:477:16)
9:08:37 AM:     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
9:08:37 AM: Emitted "error" event on ChildProcess instance at:
9:08:37 AM:     at ChildProcess._handle.onexit (node:internal/child_process:290:12)
9:08:37 AM:     at onErrorNT (node:internal/child_process:477:16)
9:08:37 AM:     at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
9:08:37 AM:   errno: -2,
9:08:37 AM:   code: "ENOENT",
9:08:37 AM:   syscall: "spawn node-gyp",
9:08:37 AM:   path: "node-gyp",
9:08:37 AM:   spawnargs: [ "rebuild" ]
9:08:37 AM: }
9:08:37 AM: Node.js v18.18.0"
info This module is OPTIONAL, you can safely ignore this error
9:08:37 AM: error /opt/build/repo/node_modules/lmdb-store: Command failed.
9:08:37 AM: Exit code: 1
9:08:37 AM: Command: node-gyp-build
9:08:37 AM: Arguments:
9:08:37 AM: Directory: /opt/build/repo/node_modules/lmdb-store
9:08:37 AM: Output:
9:08:37 AM: node:events:495
9:08:37 AM:       throw er; // Unhandled "error" event
9:08:37 AM:       ^
9:08:37 AM: Error: spawn node-gyp ENOENT
9:08:37 AM:     at ChildProcess._handle.onexit (node:internal/child_process:284:19)
9:08:37 AM:     at onErrorNT (node:internal/child_process:477:16)
9:08:37 AM:     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
9:08:37 AM: Emitted "error" event on ChildProcess instance at:
9:08:37 AM:     at ChildProcess._handle.onexit (node:internal/child_process:290:12)
9:08:37 AM:     at onErrorNT (node:internal/child_process:477:16)
9:08:37 AM:     at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
9:08:37 AM:   errno: -2,
9:08:37 AM:   code: "ENOENT",
9:08:37 AM:   syscall: "spawn node-gyp",
9:08:37 AM:   path: "node-gyp",
9:08:37 AM:   spawnargs: [ "rebuild" ]
9:08:37 AM: }
9:08:37 AM: Node.js v18.18.0
9:08:37 AM: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
9:08:39 AM: Error during Yarn install
9:08:39 AM: Build was terminated: dependency_installation script returned non-zero exit code: 1
9:08:39 AM: Failing build: Failed to install dependencies
9:08:40 AM: Failed during stage "Install dependencies": dependency_installation script returned non-zero exit code: 1
9:08:40 AM: Finished processing build request in 39.698s

I was able to deploy yur site by removing yarn.lock and package-lock.json from your repo. Once that’s done, you might have to refer to: Deploy failed today: Build was terminated: Build script returned non-zero exit code: 1 - #2 by nathanmartin

@hrishikesh it worked, thanks a lot!