Unable to import `TokenCredentialAuthenticationProvider` with ESM
@koros 已經在處理了。
開始於 2023年8月7日。
評估
這個 Issue 還沒有評估資料。
描述
Bug Report
Unable to use TokenCredentialAuthenticationProvider with ESM
Prerequisites
- Can you reproduce the problem?
- Are you running the latest version?
- Are you reporting to the correct repository?
- Did you perform a cursory search?
For more information, see the CONTRIBUTING guide.
Description
Importing TokenCredentialAuthenticationProvider and running in node 18 fails.
Console Errors:
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import 'C:\Users\erikm\projects\graph-repro\node_modules\@microsoft\microsoft-graph-client\authProviders\azureTokenCredentials' is not supported resolving ES modules imported from C:\Users\erikm\projects\graph-repro\dist\index.js
Did you mean to import @microsoft/microsoft-graph-client/authProviders/azureTokenCredentials/index.js?
at new NodeError (node:internal/errors:399:5)
at finalizeResolution (node:internal/modules/esm/resolve:319:17)
at moduleResolve (node:internal/modules/esm/resolve:945:10)
at defaultResolve (node:internal/modules/esm/resolve:1153:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
at link (node:internal/modules/esm/module_job:76:36) {
code: 'ERR_UNSUPPORTED_DIR_IMPORT',
url: 'file:///C:/Users/erikm/projects/graph-repro/node_modules/@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials'
}
Screenshots: [If applicable, add screenshots to help explain your problem]
Steps to Reproduce
- Install
@microsoft/microsoft-graph-client - Set
type: "module"in package.json - Create an index.js file with JUST this:
import { TokenCredentialAuthenticationProvider } from '@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials';
- Run
node index.js
Expected behavior:
The node application should run
Actual behavior:
Errors with
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import
SDK Version -3.0.5
- Node (Check, if using Node version of SDK)
Node Version - v18.16.0
- Browser (Check, if using Browser version of SDK)
Browser Name - [The name of Browser that you are using for SDK]
Version - [The version of the browser you are using]
- 主要語言
- TypeScript
- 星號
- 834
- 分支
- 240
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoftgraph/msgraph-sdk-javascript 的其他 Issue
-
status:waiting-for-triage
難度 1/5 1 小時以內 新手友好度 62/100
-
Is anyone here?未關閉
難度 4/5 3-5 天 新手友好度 25/100
microsoftgraph/msgraph-sdk-javascript#2005 · 1 個 reaction ·
-
status:waiting-for-triage
難度 5/5 一週以上 新手友好度 42/100
-
status:waiting-for-triage type:bug
難度 3/5 1-2 天 新手友好度 48/100
microsoftgraph/msgraph-sdk-javascript#1999 · 2 則留言 · 1 個 reaction ·
-
status:waiting-for-triage type:bug
難度 4/5 3-5 天 新手友好度 45/100
查看 microsoftgraph/msgraph-sdk-javascript 的全部 Issue
相似的 Issue
-
[Bug] The shared instance selector's placeholder and no-match text ignore the display language可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 90/100
apache/rocketmq-dashboard#5561 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
CopilotKit/OpenDots#69 ·
維護者通常 1 天內回覆
-
sendDefaultPii is reported as deprecated on ReactNativeOptions although dataCollection is hidden未關閉Bug React-Native Waiting for: Product Owner
難度 2/5 1-3 小時 新手友好度 85/100
getsentry/sentry-react-native#6830 · 1 則留言 ·
維護者通常 1 天內回覆
-
OSCI'26
難度 2/5 1-3 小時 新手友好度 68/100
GauravKarakoti/SecureFlow#1215 ·
維護者通常 1 天內回覆
-
[quality] bundle e2e never drives plain /close or the /milestone refusals through dist/index.js可能已有人在做 @hivecommons-hive 今天認領。 未關閉agent/quality hive/covered-by-pr hive/hosted-available-lke648397-260827-5q9t kind/cleanup quality testing
難度 2/5 1-3 小時 新手友好度 88/100
cncf/prow-github-actions#295 · 1 則留言 ·
維護者通常 1 天內回覆