Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🤠 July 18th

Issue with deploying a project using yarn instead of npm, resolved by adding a configuration to lerna.json file.

12 replies
Last updated: Apr 18, 2021
Having a strange deploy issue on a new project.
I'm using yarn instead of npm, so I deleted any of the package-lock files already. I get this error when deploying after most of the process goes smoothly:


348 PM: npm ERR! cipm can only install packages with an existing package-lock.json or npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or later to generate it, then try again.
I do have yarn.lock files that have a version of 1 at the top of them, so I can't figure out why this isn't sufficient.

Any thoughts of things to try?
Apr 18, 2021, 7:55 PM
It looks like that error comes from cipm, which I think requires a package-lock.json file (not a yarn.lock file). When you deleted package-lock.json did you also rimraf or delete node_modules? Where are you deploying?
Apr 18, 2021, 8:04 PM
i was having a lot of dependency issues so I deleted the cache/node_modules/package-lock at some point and restarted fresh with yarn
Apr 18, 2021, 8:05 PM
the deployment is the auto-setup one with netlify from the gatsby/sanity demo project
Apr 18, 2021, 8:06 PM
Did you first try to use NPM to deploy? In that case, your Netlify build settings may still be configured with NPM.
Apr 18, 2021, 8:07 PM
I suppose that's the default? This is the first time since the initial setup process that I'm trying to deploy.
Apr 18, 2021, 8:08 PM
Did you first try to use NPM to deploy? In that case, your Netlify build settings may still be configured with NPM.
Apr 18, 2021, 8:07 PM
Apr 18, 2021, 8:10 PM
It looks like that error comes from cipm, which I think requires a package-lock.json file (not a yarn.lock file). When you deleted package-lock.json did you also rimraf or delete node_modules? Where are you deploying?
Apr 18, 2021, 8:04 PM
i was having a lot of dependency issues so I deleted the cache/node_modules/package-lock at some point and restarted fresh with yarn
Apr 18, 2021, 8:05 PM
the deployment is the auto-setup one with netlify from the gatsby/sanity demo project
Apr 18, 2021, 8:06 PM
Figured it out! Thanks for the effort Geoff.
So, initially the build process was auto-detecting yarn and installing packages with yarn, but then when running 'lerna bootstrap' it defaults to npm.

The solution was to add '"npmClient": "yarn",' to my lerna.json file in my root directory.
Apr 18, 2021, 8:25 PM
Great! Glad you got it working. 🙂
Apr 18, 2021, 8:27 PM

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.

Was this answer helpful?