insin / gatsby-plugin-dark-mode

A Gatsby plugin which handles some of the details of implementing a dark mode theme
MIT License
68 stars 19 forks source link

React 17 #16

Open axelra82 opened 3 years ago

axelra82 commented 3 years ago

Installing on latest react (17.x)

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

Looks like alvinometric made a fix, just needs merging in: https://github.com/insin/gatsby-plugin-dark-mode/pull/15

ghost commented 3 years ago

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

mrocha98 commented 3 years ago

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

npm i gatsby-plugin-dark-mode --legacy-peer-deps
dinhanhthi commented 2 years ago

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!

th0rgall commented 2 years ago

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.