Issue with unsupported engine in Gridsome project resolved by removing engine options in package.json.

3 replies
Last updated: Oct 21, 2021
Hey everyone! I am starting a new sanity project with gridsome and am running into the following terminal error:
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: sanity-gridsome@1.0.5
npm ERR! notsup Not compatible with your version of node/npm: sanity-gridsome@1.0.5
npm ERR! notsup Required: {"npm":"^6.10.0","node":"^14.1.0"}
npm ERR! notsup Actual:   {"npm":"8.1.0","node":"v14.18.1"}
I have used Sanity and Gridsome a lot in the past together, but I did notice there was a recent update to the template/soure-plugin a couple months ago so maybe this might be connected? Perhaps I am just doing something wrong as well.. I have the latest stable versions of npm and node downloaded. All I did was create a sanity template through the installer on
Sanity.io and then did a npm install in the root folder after cloning the repo locally.
Seems to be an issue with Lerna as the web/studio folders both work after an npm install.
AI Update

I can see you're hitting an npm engine compatibility issue with the sanity-gridsome package. The error message is a bit confusing because it says you need npm ^6.10.0 but you have npm 8.1.0, which should actually satisfy that requirement. However, the issue is likely related to how Lerna (the monorepo tool) is handling engine checks in the root package.

Here are a few solutions to try:

Option 1: Use the --legacy-peer-deps flag

npm install --legacy-peer-deps

This tells npm to bypass strict peer dependency and engine checks, which should allow the installation to proceed.

Option 2: Downgrade npm temporarily Since the package specifically mentions npm ^6.10.0, you could try using npm 6.x:

npm install -g npm@6.14.15

Then run your npm install again in the project root. You can always upgrade npm back to v8 afterward.

Option 3: Use the --force flag

npm install --force

This will override the engine check entirely.

Option 4: Install in individual directories Since you mentioned the web/ and studio/ folders work individually, you could:

  1. cd web && npm install
  2. cd ../studio && npm install
  3. Skip the root-level install if it's only used for Lerna orchestration

About the underlying issue:

You're right that there was likely a recent update to the Sanity Gridsome source plugin. The sanity-gridsome package in the root is probably a Lerna helper package with overly strict engine requirements that don't account for newer npm versions.

It's worth noting that Gridsome's development has slowed considerably in recent years, and the Vue.js ecosystem has largely moved toward frameworks like Nuxt for static site generation. If you're starting a new project, you might want to consider using Nuxt 3 with Sanity instead, as it has more active development and better long-term support.

Let me know which solution works for you!

user M
I found the issue. Not related to Lerna..
The issue was the engine options within the root package.json file. I first deleted the package-lock.json files and took out the
engine
and
engineStrict
options and it worked perfectly. I would suggest to take those out in the Gridsome template starter unless its absolutely necessary. I think this may also be the issue that others are having as well upon getting an error when starting up development. Hope this help!:)
user M
I found the issue. Not related to Lerna..
The issue was the engine options within the root package.json file. I first deleted the package-lock.json files and took out the
engine
and
engineStrict
options and it worked perfectly. I would suggest to take those out in the Gridsome template starter unless its absolutely necessary. I think this may also be the issue that others are having as well upon getting an error when starting up development. Hope this help!:)
Very helpful User! Thanks so much for the update. I'll pass this along to the applications team.

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.

Was this answer helpful?