πŸ‘€ Our most exciting product launch yet πŸš€ Join us May 8th for Sanity Connect

Unable to Deploy to Netlify After Upgrade - npm ERR! code ERESOLVE

16 replies
Last updated: Jul 12, 2022
Hey people, I am having a weird issue. I can't deploy on netlify any longer, even though nothing has changed related to sanity. So I tried upgrading, and I am getting this error message:
Jul 11, 2022, 9:40 PM
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: sanity-eleventy-blog-studio@1.0.12
npm ERR! Found: @sanity/base@2.30.1
npm ERR! node_modules/@sanity/base
npm ERR!   @sanity/base@"^2.30.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @sanity/base@"^1" from sanity-plugin-dashboard-widget-document-list@0.0.11
npm ERR! node_modules/sanity-plugin-dashboard-widget-document-list
npm ERR!   sanity-plugin-dashboard-widget-document-list@"^0.0.11" from the root project
Jul 11, 2022, 9:40 PM
this is the exact same error message, that netlify gives me as well.
Jul 11, 2022, 9:40 PM
yet building it locally works just fine, on node 16 & node 17
Jul 11, 2022, 9:40 PM
I am thankful for any and all ideas
Jul 11, 2022, 9:41 PM
What does your
package.json
look like?
Jul 11, 2022, 9:42 PM
In root, it only has lerna as a dependency. I just ran
npm upgrade --legacy-peer-deps
, after that,
/studio
looks like this:
{
  "private": true,
  "name": "sanity-eleventy-blog-studio",
  "version": "1.0.12",
  "main": "package.json",
  "author": "Sanity <hello@sanity.io>",
  "scripts": {
    "dev": "sanity start",
    "format": "prettier-eslint --write \"**/*.js\" \"!node_modules/**\"",
    "build": "sanity build",
    "graphql-deploy": "sanity graphql deploy --playground",
    "lint": "eslint .",
    "test": "sanity check"
  },
  "dependencies": {
    "@sanity/base": "^2.30.1",
    "@sanity/cli": "^2.30.2",
    "@sanity/components": "^2.14.0",
    "@sanity/core": "^2.30.2",
    "@sanity/dashboard": "^2.30.1",
    "@sanity/default-layout": "^2.30.1",
    "@sanity/default-login": "^2.30.1",
    "@sanity/desk-tool": "^2.30.1",
    "date-fns": "^1.30.1",
    "prop-types": "^15.7.2",
    "react": "^16.14.0",
    "react-dom": "^16.14.0",
    "react-icons": "^3.11.0",
    "sanity-plugin-dashboard-widget-document-list": "^0.0.11",
    "sanity-plugin-dashboard-widget-netlify": "^1.0.1",
    "styled-components": "^5.3.5"
  },
  "devDependencies": {
    "babel-eslint": "^10.0.1",
    "eslint": "^5.16.0",
    "eslint-config-standard": "^12.0.0",
    "eslint-config-standard-react": "^7.0.2",
    "eslint-plugin-import": "^2.17.3",
    "eslint-plugin-node": "^9.1.0",
    "eslint-plugin-promise": "^4.1.1",
    "eslint-plugin-react": "^7.13.0",
    "eslint-plugin-standard": "^4.0.0",
    "prettier-eslint-cli": "^4.7.1"
  }
}
Jul 11, 2022, 9:43 PM
even after the upgrade, the error still persists
Jul 11, 2022, 10:07 PM
I honestly don't know what to do.
Jul 11, 2022, 10:27 PM
I'm at a loss here, too. I haven't come across this one before. I will keep looking though!
Jul 11, 2022, 10:28 PM
so... what is my course of action here then?
Jul 11, 2022, 10:38 PM
ask for help with netlify?
Jul 11, 2022, 10:38 PM
I literally can't even update the site
Jul 11, 2022, 10:38 PM
not saying someone needs to solve this, my client just literally cannot update their website any longer. Do I need to rebuild the entire website now?
Jul 11, 2022, 10:39 PM
No, you don't need to rebuild. You could try adding a
.npmrc
file with:
legacy-peer-deps=true
To force it through.
Jul 11, 2022, 10:44 PM
Could you please set npm 7 as your engine in your package.json and try again please?
  "engines": {
    "node": "16.x",
    "npm": "7"
  },
From version 8 onwards, npm is being aggressive with legacy peer dependencies, but npm 7 is fine with it.
Jul 12, 2022, 7:03 AM
Thank you
user F
&amp;
user M
- that helped! It's building now. You saved my week πŸ™‚
Jul 12, 2022, 8:57 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?