microsoftgraph / microsoft-graph-toolkit

Authentication Providers and UI components for Microsoft Graph 🦒
https://docs.microsoft.com/graph/toolkit/overview
Other
949 stars 305 forks source link

[BUG] unable to resolve dependency tree peer react@"^17.0.1" from @microsoft/mgt-react@2.11.0 #2386

Closed therealjohn closed 1 year ago

therealjohn commented 1 year ago

Describe the bug After the 2.11.0 release, Teams Toolkit project templates have an error when running npm install because the 2.11.0 package seems to revert back to depending on React 17. 2.8-2.10 were working OK before this.

   (×) Error: Command failed: npm install --no-audit
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: TestReact@0.1.0
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   react@"^18.2.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^17.0.1" from @microsoft/mgt-react@2.11.0
npm ERR! node_modules/@microsoft/mgt-react
npm ERR!   @microsoft/mgt-react@"^2.8.0" from the root project

To Reproduce

"dependencies": {
        "@fluentui/react-components": "^9.18.0",
        "@microsoft/mgt-element": "2.11.0",
        "@microsoft/mgt-react": "2.11.0",
        "@microsoft/mgt-teamsfx-provider": "2.11.0",
        "@microsoft/microsoft-graph-client": "^3.0.1",
        "@microsoft/teams-js": "^2.7.1",
        "@microsoft/teamsfx": "^2.2.0",
        "@microsoft/teamsfx-react": "^3.0.0",
        "axios": "^0.21.1",
        "react": "^18.2.0",
        "react-dom": "^18.2.0",
        "react-router-dom": "^6.8.0",
        "react-scripts": "^5.0.1"
    },

Expected behavior React 18 supported like previous minor versions.

Environment (please complete the following information):

Additional context This breaks the getting started experience for project templates in Teams Toolkit by default because we have ^2.8.0 in the package.json.

ghost commented 1 year ago

Hello therealjohn, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

sebastienlevert commented 1 year ago

We are currently working on a fix and should be available today. We will be removing the peer dependency from React 17 to allow React 18 scenarios with the caveat that it will run (as it did before 2.11) in React 17 mode.