microsoft-authentication-library-for-js icon indicating copy to clipboard operation
microsoft-authentication-library-for-js copied to clipboard

Unable to install MSAL React in React 19

Open ritwickg opened this issue 11 months ago • 11 comments

Core Library

MSAL.js (@azure/msal-browser)

Wrapper Library

MSAL React (@azure/msal-react)

Public or Confidential Client?

Public

Description

Msal_React_Version_Error

The msal react installation in react 19 is failing with the attached error

ritwickg avatar Dec 23 '24 05:12 ritwickg

Unable to install MSAL react in react 19. Is react 19 supported for the current version of MSAL ? When can we expect MSAL to support React 19 ?

Anyone please help!!!

veersuman1999 avatar Dec 23 '24 05:12 veersuman1999

Same issue. This library is preventing us from upgrading to React 19.

stevebuckco avatar Dec 26 '24 15:12 stevebuckco

FYI, in the meantime you can just add the following override to your package.json as a workaround (before you run npm i @azure/msal-react:

  "overrides": {
    "react": "$react"
  },

SunnyJohal avatar Dec 26 '24 17:12 SunnyJohal

If you want to scope the override to just the msal package do this instead:

  "overrides": {
    "@azure/msal-react": {
      "react": "$react"
    }
  },

SunnyJohal avatar Dec 26 '24 17:12 SunnyJohal

Hope upgrading to React19 without any unexcepted operation

Lomnus avatar Dec 28 '24 12:12 Lomnus

"overrides": { "@azure/msal-react": { "react": "$react" } }, @SunnyJohal Thanks for the help. This works fine for now.

veersuman1999 avatar Jan 03 '25 04:01 veersuman1999

Could you please merge the PR ...

lucas-garrido avatar Jan 06 '25 09:01 lucas-garrido

PR https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/7467 seems related to this issue, but it is currently not yet merged.

andersthorbeck avatar Jan 09 '25 12:01 andersthorbeck

Ah, this issue seems to be a duplicate of https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/7455.

andersthorbeck avatar Jan 09 '25 12:01 andersthorbeck

Blocked due to this package dependency when upgrading to React 19.

SantoshPisini avatar Jan 11 '25 06:01 SantoshPisini

Seeing a similar issue I resolved using configuration settings, would a solution be to use:

.npmrc
legacy-peer-deps=true

or

npm install --legacy-peer-deps

This should at least allow the install to complete.

devopsbob avatar Feb 04 '25 20:02 devopsbob

See this pull request: https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/7710

Ben-CA avatar Apr 28 '25 19:04 Ben-CA