insin / gatsby-plugin-dark-mode

A Gatsby plugin which handles some of the details of implementing a dark mode theme

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React 17

axelra82 opened this issue · comments

commented

Installing on latest react (17.x)

Could not resolve dependency:
npm ERR! peer react@"16.x" from gatsby-plugin-dark-mode@1.1.2

Looks like alvinometric made a fix, just needs merging in: #15

Yep, still waiting 😄
As a temporary fix, you can downgrade your NPM to a version less than 7

I'm using NPM 7 and have successfully installed using the --legacy-peer-deps flag

npm i gatsby-plugin-dark-mode --legacy-peer-deps

I'm using NPM 7 and have successfully installed using the --legacy-peer-deps flag

npm i gatsby-plugin-dark-mode --legacy-peer-deps

It works for me, thanks!

I could use the --legacy-peer-deps workaround locally with npm@7, but for remote CI/CD builds using Gatsby Cloud it's necessary to instruct the build process to use npm@6 instead (the downgrade mentioned above), using the engines property in package.json:

  "engines": {
    "node": "^16",
    "npm": "^6"
  },

This worked for me. I know Heroku's node buildpacks also respect npm engine versions, Vercel and others probably do too.