microsoft-authentication-library-for-js
microsoft-authentication-library-for-js copied to clipboard
This dependency was not found
Core Library
MSAL.js (@azure/msal-browser)
Core Library Version
3.6.0
Wrapper Library
MSAL Angular (@azure/msal-angular)
Wrapper Library Version
^14.5.0
Public or Confidential Client?
Public
Description
I have installed both "@azure/msal-browser": "^3.6.0", "@azure/msal-common": "^14.5.0" and when I run npm run serve I receive the error describet in error description section.
Error Message
This dependency was not found:
- @azure/msal-common in ./node_modules/@azure/msal-browser/dist/index.mjs, ./node_modules/@azure/msal-browser/dist/controllers/UnknownOperatingContextController.mjs and 5 others
To install it, you can run: npm install --save @azure/msal-common
Msal Logs
.
MSAL Configuration
const msalConfig = {
auth: {
clientId: '',
authority: 'https://login.microsoftonline.com/ ',
redirectUri: 'https://testbasecamp.doublepass.com/#/',
},
};
Relevant Code Snippets
/*! @azure/msal-browser v3.6.0 2023-12-01 */
'use strict';
import * as BrowserUtils from './utils/BrowserUtils.mjs';
export { BrowserUtils };
export { PublicClientApplication } from './app/PublicClientApplication.mjs';
export { PublicClientNext } from './app/PublicClientNext.mjs';
export { DEFAULT_IFRAME_TIMEOUT_MS } from './config/Configuration.mjs';
export { ApiId, BrowserCacheLocation, CacheLookupPolicy, InteractionStatus, InteractionType, WrapperSKU } from './utils/BrowserConstants.mjs';
export { BrowserAuthError, BrowserAuthErrorMessage } from './error/BrowserAuthError.mjs';
export { BrowserConfigurationAuthError, BrowserConfigurationAuthErrorMessage } from './error/BrowserConfigurationAuthError.mjs';
export { stubbedPublicClientApplication } from './app/IPublicClientApplication.mjs';
export { NavigationClient } from './navigation/NavigationClient.mjs';
export { MemoryStorage } from './cache/MemoryStorage.mjs';
export { BrowserStorage } from './cache/BrowserStorage.mjs';
export { EventMessageUtils } from './event/EventMessage.mjs';
export { EventType } from './event/EventType.mjs';
export { SignedHttpRequest } from './crypto/SignedHttpRequest.mjs';
export { BrowserPerformanceClient } from './telemetry/BrowserPerformanceClient.mjs';
export { BrowserPerformanceMeasurement } from './telemetry/BrowserPerformanceMeasurement.mjs';
export { AccountEntity, AuthError, AuthErrorCodes, AuthErrorMessage, AuthenticationHeaderParser, AuthenticationScheme, AzureCloudInstance, ClientAuthError, ClientAuthErrorCodes, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorCodes, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorCodes, InteractionRequiredAuthErrorMessage, JsonWebTokenTypes, LogLevel, Logger, OIDC_DEFAULT_SCOPES, PerformanceEvents, PromptValue, ProtocolMode, ServerError, ServerResponseType, StringUtils, UrlString } from '@azure/msal-common';
export { version } from './packageMetadata.mjs';
import * as BrowserAuthErrorCodes from './error/BrowserAuthErrorCodes.mjs';
export { BrowserAuthErrorCodes };
import * as BrowserConfigurationAuthErrorCodes from './error/BrowserConfigurationAuthErrorCodes.mjs';
export { BrowserConfigurationAuthErrorCodes };
Reproduction Steps
install msal browser install msal common.
Expected Behavior
No error shown.
Identity Provider
Azure AD / MSA
Browsers Affected (Select all that apply)
Chrome
Regression
@azure/msal-common": "^14.5.0
Source
Internal (Microsoft)
Getting the same exact error when using @azure/msal-browser.
- node 14.x
- npm 6.x
- Vue CLI 4.5 (webpack under the hood)
II'm getting same problem running @azure/msal-browser 3.6.0 and @azure/msal-common 14.5.0, can't resolve @azure/msal-common in /node_modules/@azure/msal-browser/dist/index.mjs
Same issue here, trying to downgrade but I still can't find the working combo between msal-common and msal-browser
I ended up biting the bullet and upgrading to latest versions of node and react. I made a lot of other changes as a result. But it seems tl have solved this particular issue.
I found out the cause. It's outdated bundler in user app.
For example if your app were using an old webpack v4, it doesn't fully understand the new package.json format in msal-common,
"exports": {
".": {
"types": "./dist/index.d.ts",
"module": "./dist/index.mjs",
"import": "./dist/index.mjs",
"require": "./lib/index.cjs",
"default": "./dist/index.mjs"
},
"./package.json": "./package.json"
},
This issue can be bypassed with added main field in msal-common package.json (manually touch it in your app's node_module folder).
"main": "./dist/index.mjs",
But I got many new transpiler errors because the old one in my webpack setup doesn't support the newer JS syntax uses in msal code.
From nodejs doc
For new packages targeting the currently supported versions of Node.js, the "exports" field is recommended. For packages supporting Node.js 10 and below, the "main" field is required. If both "exports" and "main" are defined, the "exports" field takes precedence over "main" in supported versions of Node.js.
It sounds like adding "main" field back to msal-* packages would not hurt.
It may also help folks who use the (now deprecated, but still pulling 2.5m downloads a week due to its widespread usage) esm package which unfortunately does not understand exports
I created a repro here: https://github.com/maorleger/msal-2-esm-repro
I would suggest doing the same thing for @azure/msal-node (adding main back) which should be harmless and greatly improve compatibility
I am also getting the same error while updating the @azure/msal-browser from version 2.x.x to 3.9.0. Also this error only occurs after running the project using 'npm run serve-dev'
Errors: This dependency was not found:
- @azure/msal-common in ./node_modules/@azure/msal-browser/dist/index.mjs, ./node_modules/@azure/msal-browser/dist/controllers/UnknownOperatingContextController.mjs and 3 others
To install it, you can run: npm install --save @azure/msal-common
@hectormmg can you review this issue and if we can help?
I ended up biting the bullet and upgrading to latest versions of node and react. I made a lot of other changes as a result. But it seems tl have solved this particular issue.
Could you please provide the changes you did related to package updates?
Hi I'm using azure/msal-browser (3.02) azure/msal-common (14.6.0) azure/msal-react (2.02)) react 18.2.0 node 20.10.0
has been working fine in production for several months now.
Hope that helps.
From: Dardan Shabani @.> Sent: 02 April 2024 08:49 To: AzureAD/microsoft-authentication-library-for-js @.> Cc: Mark Carter @.>; Comment @.> Subject: Re: [AzureAD/microsoft-authentication-library-for-js] This dependency was not found (Issue #6793)
I ended up biting the bullet and upgrading to latest versions of node and react. I made a lot of other changes as a result. But it seems tl have solved this particular issue.
Could you please provide the changes you did related to package updates?
— Reply to this email directly, view it on GitHubhttps://github.com/AzureAD/microsoft-authentication-library-for-js/issues/6793#issuecomment-2031307079, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWN7LFUV3PO5CEKCV2E53RTY3JPG3AVCNFSM6AAAAABBGVZRWCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZRGMYDOMBXHE. You are receiving this because you commented.
Facing the same issue with Vue3, any update on this?
If you use latest vite with vue 3, there should not be any issue.
Are folks still facing this issue with the latest versions? If so, please share a minimal reproduction.
@dardanshabani This issue has been automatically marked as stale because it is marked as requiring author feedback but has not had any activity for 5 days. If your issue has been resolved please let us know by closing the issue. If your issue has not been resolved please leave a comment to keep this open. It will be closed automatically in 7 days if it remains stale.