Issue with deploying a project using yarn instead of npm, resolved by adding a configuration to lerna.json file.
This is a classic mismatch between your local package manager (yarn) and what the deployment environment is trying to use (npm). The error message about cipm (a now-deprecated npm command) indicates that your deployment platform is trying to use npm to install packages, but it's looking for package-lock.json which doesn't exist because you're using yarn.
Here are some things to try:
1. Check your deployment platform's settings
If you're deploying to Netlify, Vercel, or another hosting platform (not using sanity deploy), you need to tell it to use yarn instead of npm. Look for:
- A build settings section where you can specify the package manager
- Environment variables like
NPM_USE_YARN=trueor similar - Build command configuration - make sure it's using
yarncommands, notnpm
2. Add a .npmrc or configuration file
Some platforms detect the package manager automatically if you add a .yarnrc file or specify it in your project configuration. Check your platform's documentation for how to specify yarn as the package manager.
3. If using sanity deploy directly
The sanity deploy command should handle this automatically, but if you're seeing this error, try:
- Making sure your
package.jsonscripts use yarn:"deploy": "sanity deploy" - Running
yarn installlocally first to ensure youryarn.lockis up to date - Checking if there are any cached
node_modulesor lock files that need clearing
4. Switch to npm (if needed)
If the deployment platform doesn't support yarn well, you could:
- Delete
yarn.lock - Run
npm installto generate apackage-lock.json - Commit the
package-lock.jsonfile - Use npm commands going forward
5. Check for hidden lock files
Sometimes package-lock.json files hide in subdirectories. Run:
find . -name "package-lock.json" -type fAnd delete any you find if you want to stick with yarn.
The key issue is that your deployment environment is configured to use npm but your project is set up for yarn. You need to either configure the deployment to use yarn, or switch your project to npm. If you let me know which platform you're deploying to, I can give more specific guidance!
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.