mattmilburn / strapi-plugin-preview-button

A plugin for Strapi CMS that adds a preview button and live view button to the content manager edit view.
MIT License
99 stars 35 forks source link

React 17.0.2 Peer dependency #104

Closed cherring07 closed 11 months ago

cherring07 commented 1 year ago

Base install of...

Base install of...
"dependencies": {
    "@strapi/strapi": "4.12.5",
    "@strapi/plugin-users-permissions": "4.12.5",
    "@strapi/plugin-i18n": "4.12.5",
    "better-sqlite3": "8.5.0"
  },

Running...

npm i strapi-plugin-preview-button@latest

Then...

npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   peer react@"^17.0.0 || ^18.0.0" from @strapi/design-system@1.9.0
npm ERR!   node_modules/@strapi/design-system
npm ERR!     peer @strapi/design-system@"^1.6.0" from strapi-plugin-preview-button@2.0.0
...
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^17.0.2" from strapi-plugin-preview-button@2.0.0
npm ERR! node_modules/strapi-plugin-preview-button
npm ERR!   strapi-plugin-preview-button@"2.0.0" from the root project
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

I think bumping the React version should solve the error, but not sure if there are any side effects,

LucasLavallee commented 1 year ago

Same issue here

joserangel25 commented 12 months ago

Hi, I have the same problem. When trying to install the plugin it gives me errors regarding React:

npm ERR! While resolving: backend@0.1.0 npm ERR! Found: react@18.2.0 npm ERR! node_modules/react npm ERR! peer react@"^17.0.0 || ^18.0.0" from @strapi/design-system@1.10.1 npm ERR! node_modules/@strapi/design-system npm ERR! peer @strapi/design-system@"^1.6.0" from strapi-plugin-preview-button@2.0.0 npm ERR! node_modules/strapi-plugin-preview-button npm ERR! strapi-plugin-preview-button@"*" from the root project npm ERR! peer @strapi/design-system@"1.10.1" from @strapi/helper-plugin@4.13.6 npm ERR! node_modules/@strapi/helper-plugin npm ERR! peer @strapi/helper-plugin@"^4.9.0" from strapi-plugin-preview-button@2.0.0 npm ERR! node_modules/strapi-plugin-preview-button npm ERR! strapi-plugin-preview-button@"*" from the root project npm ERR! peer react@"^17.0.0 || ^18.0.0" from @strapi/icons@1.10.1 npm ERR! node_modules/@strapi/icons npm ERR! peer @strapi/icons@"^1.6.0" from strapi-plugin-preview-button@2.0.0 npm ERR! node_modules/strapi-plugin-preview-button npm ERR! strapi-plugin-preview-button@"*" from the root project npm ERR! peer @strapi/icons@"^1.5.0" from @strapi/design-system@1.10.1 npm ERR! node_modules/@strapi/design-system npm ERR! peer @strapi/design-system@"^1.6.0" from strapi-plugin-preview-button@2.0.0 npm ERR! node_modules/strapi-plugin-preview-button npm ERR! strapi-plugin-preview-button@"*" from the root project npm ERR! 1 more (@strapi/helper-plugin) npm ERR! 1 more (@strapi/helper-plugin) npm ERR! 4 more (react-dom, react-router-dom, styled-components, @strapi/helper-plugin) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"^17.0.2" from strapi-plugin-preview-button@2.0.0 npm ERR! node_modules/strapi-plugin-preview-button npm ERR! strapi-plugin-preview-button@"*" from the root project

Does anybody know how I can fix it?

heichel commented 11 months ago

Hi @mattmilburn, are you planning on merging one of the open PRs updating the peer dependency? If not, is there a workaround? We would like to use your preview buttons in a current project.

mattmilburn commented 11 months ago

Hi @cherring07 @LucasLavallee @joserangel25 @heichel, this should be fixed in the latest release v2.1.0. For the record, I was never able to reproduce this but it doesn't hurt to add the support, which was inevitable anyway.

If you continue to have issues, please post about it here and include as much of your package.json as possible and maybe screenshots/errors if you have them.