Issue deploying site to Netlify due to missing dependencies
4 replies
Last updated: Jun 16, 2021
M
Hi everyone, I am having an issue with deploying my site to Netlify. I am getting this error:
I am using the sanity-gatsby blog starter. Been tweaking it locally, and all was working fine. When I committed my changes to my repo, and deployed my site on netlify I got this error. I must have done something wrong..I am new to all of this and would greatly appreciate any help. Thank you
😊
Failed during stage 'building site': Build script returned non-zero exit code: 2
I am using the sanity-gatsby blog starter. Been tweaking it locally, and all was working fine. When I committed my changes to my repo, and deployed my site on netlify I got this error. I must have done something wrong..I am new to all of this and would greatly appreciate any help. Thank you
😊
Jun 14, 2021, 11:16 AM
M
Thank you for your reply
user A
,7:34:28 PM: build-image version: 0582042f4fc261adc7bd8333f34884959c577302 7:34:28 PM: build-image tag: v3.7.6 7:34:28 PM: buildbot version: 46ee531a6ee957f94fb29adfde3b52177c7d5147 7:34:28 PM: Building without cache 7:34:28 PM: Starting to prepare the repo for build 7:34:29 PM: No cached dependencies found. Cloning fresh repo 7:34:29 PM: git clone git@github.com:mxysaj/launchblog 7:34:30 PM: Preparing Git Reference refs/heads/main 7:34:31 PM: Parsing package.json dependencies 7:34:31 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: '' versus '/' in the Netlify UI 7:34:32 PM: Starting build script 7:34:32 PM: Installing dependencies 7:34:32 PM: Python version set to 2.7 7:34:33 PM: v12.18.0 is already installed. 7:34:34 PM: Now using node v12.18.0 (npm v6.14.4) 7:34:34 PM: Started restoring cached build plugins 7:34:34 PM: Finished restoring cached build plugins 7:34:34 PM: Attempting ruby version 2.7.1, read from environment 7:34:35 PM: Using ruby version 2.7.1 7:34:36 PM: Using PHP version 5.6 7:34:36 PM: Started restoring cached node modules 7:34:36 PM: Finished restoring cached node modules 7:34:36 PM: Installing NPM modules using NPM version 6.14.4 7:34:54 PM: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it! 7:34:54 PM: > sanity-gatsby-blog@1.0.17 postinstall /opt/build/repo 7:34:54 PM: > lerna bootstrap 7:34:54 PM: lerna notice cli v3.22.1 7:34:54 PM: lerna info ci enabled 7:34:55 PM: lerna info Bootstrapping 2 packages 7:34:55 PM: lerna info Installing external dependencies 7:34:56 PM: lerna ERR! npm ci exited 1 in 'blog-with-gatsby-studio' 7:34:56 PM: lerna ERR! npm ci stderr: 7:34:56 PM: npm ERR! cipm can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing. 7:34:56 PM: npm ERR! 7:34:56 PM: npm ERR! 7:34:56 PM: npm ERR! Missing: @sanity/code-input@^2.9.0 7:34:56 PM: npm ERR! 7:34:56 PM: npm ERR! A complete log of this run can be found in: 7:34:56 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-06-14T15_34_56_063Z-debug.log 7:34:56 PM: lerna ERR! npm ci exited 1 in 'blog-with-gatsby-studio' 7:34:56 PM: lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately. 7:34:56 PM: npm ERR! code ELIFECYCLE 7:34:56 PM: npm ERR! errno 1 7:34:56 PM: npm ERR! sanity-gatsby-blog@1.0.17 postinstall: `lerna bootstrap` 7:34:56 PM: npm ERR! Exit status 1 7:34:56 PM: npm ERR! 7:34:56 PM: npm ERR! Failed at the sanity-gatsby-blog@1.0.17 postinstall script. 7:34:56 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 7:34:56 PM: npm ERR! A complete log of this run can be found in: 7:34:56 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-06-14T15_34_56_164Z-debug.log 7:34:56 PM: Error during NPM install 7:34:56 PM: Build was terminated: Build script returned non-zero exit code: 1 7:34:56 PM: Creating deploy upload records 7:34:56 PM: Failing build: Failed to build site 7:34:56 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 7:34:56 PM: Finished processing build request in 27.800705191s
Jun 14, 2021, 3:57 PM
T
Try deleting your node_modules and re-running
npm install
Jun 15, 2021, 11:24 PM
T
Then push to GitHub again
Jun 15, 2021, 11:25 PM
M
Thanks
user C
for your reply. I somehow managed to solve the issue. I guess this was because not all the dependencies were in the top-level package.jsonfile. I created a new repo and reinstalled everything and now its up and running 🙌
Jun 16, 2021, 6:25 AM
Sanity– build remarkable experiences at scale
Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.