Example "aot-module" fails with [ERR_MODULE_NOT_FOUND]: Cannot find package 'node-api-dotnet'
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 45/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- csharp, javascript, node.js
- 領域
- build-system
研究方向
首先在回報的提交上執行 examples/aot-module/README.md 中的命令,並檢查 bin/aot-module.js,尤其是其中對 node-api-dotnet 的匯入。文件中的命令能夠成功執行並輸出 "Hello .NET AOT!",且無需手動替換匯入時,該 issue 即完成。
由索引模型根據 Issue 內容生成。
描述
To repro, I'm on main branch commit 11c5a48.
I'm following the instructions at examples/aot-module/README.md:
cd examples\aot-module
dotnet pack ../..
dotnet publish
node example.js
And I get this error:
node:internal/modules/package_json_reader:268
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'node-api-dotnet' imported from D:\node-api-dotnet\examples\aot-module\bin\aot-module.js
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:268:9)
at packageResolve (node:internal/modules/esm/resolve:768:81)
at moduleResolve (node:internal/modules/esm/resolve:854:18)
at defaultResolve (node:internal/modules/esm/resolve:984:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:685:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:634:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:617:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:273:38)
at ModuleJob._link (node:internal/modules/esm/module_job:135:49) {
code: 'ERR_MODULE_NOT_FOUND'
}
Node.js v22.14.0
I found I could fix this by making this change in bin/aot-module.js:
// Removed this line:
//import dotnet from 'node-api-dotnet/net8.0';
// Added this line:
const dotnet = undefined;
And then it works fine:
Hello .NET AOT!
- 主要語言
- C#
- 星號
- 788
- 分支
- 80
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/node-api-dotnet 的其他 Issue
-
難度 1/5 1-3 小時 新手友好度 88/100
microsoft/node-api-dotnet#484 ·
-
Embedding args occasionally get trailing garbage on .NET (missing null terminator on a pooled buffer)可能已有人在做 @tolmachev-pravo 於 97 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 82/100
microsoft/node-api-dotnet#481 ·
-
JSError.ThrowError(Exception) aborts the process when a Worker terminates during a .NET call可能已有人在做 @GalaxiasKyklos 於 6 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 18/100
microsoft/node-api-dotnet#505 ·
-
難度 3/5 1-2 天 新手友好度 70/100
microsoft/node-api-dotnet#504 ·
-
難度 3/5 1-2 天 新手友好度 82/100
microsoft/node-api-dotnet#502 ·
查看 microsoft/node-api-dotnet 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 77/100
維護者通常 1 天內回覆
-
[Docs] README/PRIVACY still name AppCenter although v1.5.6.0+ uses the Microsoft Store Services SDK未關閉
難度 2/5 1-3 小時 新手友好度 78/100
-
bug
難度 2/5 1-3 小時 新手友好度 66/100
swisstopo/swissgeol-boreholes-suite#3086 ·
維護者通常 1 天內回覆
-
bug
難度 1/5 1 小時以內 新手友好度 65/100
維護者通常 1 天內回覆
-
frontend
難度 2/5 1-3 小時 新手友好度 72/100
Altinn/altinn-studio#21355 ·
維護者通常 1 天內回覆