Would be good to have a debug log for failed module resolution
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 55/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- node.js, typescript
- 领域
- tooling
调研方向
从 packages/host/src/node/path-utils.ts 中的 resolvePackageRoot 以及其 catch 块中的 TODO 开始。重现 issue 中所示的 index.cjs 解析失败,然后验证解析失败会输出调试日志,同时函数仍返回 undefined。
由索引模型根据 Issue 内容生成。
描述
Just got tripped up by this, but figured it out (my npm package was missing an index.cjs file). Would've figured it out sooner if we'd had an error log (which indeed was TODO), so just tracking this.
export function resolvePackageRoot(
// createRequire(path.join("/Users/jamie/Documents/git/expo-macos-nativescript", "noop.js"))
requireFromPackageRoot: NodeJS.Require,
// "@nativescript/macos-node-api"
packageName: string,
): string | undefined {
try {
const resolvedPath = requireFromPackageRoot.resolve(packageName);
return packageDirectorySync({ cwd: resolvedPath });
} catch {
// TODO: Add a debug log here
return undefined;
}
}
Error: Cannot find module '/Users/jamie/Documents/git/expo-macos-nativescript/node_modules/@nativescript/macos-node-api/index.cjs'
at createEsmNotFoundErr (/Users/jamie/Documents/git/expo-macos-nativescript/lib/internal/modules/cjs/loader.js:1493:15)
at finalizeEsmResolution (/Users/jamie/Documents/git/expo-macos-nativescript/lib/internal/modules/cjs/loader.js:1482:9)
at resolveExports (/Users/jamie/Documents/git/expo-macos-nativescript/lib/internal/modules/cjs/loader.js:685:14)
at Module._findPath (/Users/jamie/Documents/git/expo-macos-nativescript/lib/internal/modules/cjs/loader.js:752:31)
at Module._resolveFilename (/Users/jamie/Documents/git/expo-macos-nativescript/lib/internal/modules/cjs/loader.js:1441:27)
at require.resolve (/Users/jamie/Documents/git/expo-macos-nativescript/lib/internal/modules/helpers.js:163:19)
at eval (<node_internals>/eval-b052276f.repl:1:30)
at resolvePackageRoot (/Users/jamie/Documents/git/expo-macos-nativescript/node_modules/react-native-node-api/dist/node/path-utils.js:215:9)
at /Users/jamie/Documents/git/expo-macos-nativescript/node_modules/react-native-node-api/dist/node/path-utils.js:247:40
at Array.flatMap (<anonymous>) {code: 'MODULE_NOT_FOUND', path: '/Users/jamie/Documents/git/expo-macos-nativescript/node_modules/@nativescript/macos-node-api', stack: "Error: Cannot find module '/Users/jamie/Docum….js:247:40
at Array.flatMap (<anonymous>)", message: "Cannot find module '/Users/jamie/Documents/g…ules/@nativescript/macos-node-api/index.cjs'"}
- 主要语言
- TypeScript
- 星标
- 188
- 派生
- 10
- 平均合并
- 2 天 17 小时
- 30 天内合并 PR
- 3
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
callstackincubator/react-native-node-api 的其他 Issue
-
Android 🤖
难度 2/5 1-3 小时 新手友好度 66/100
-
Sanity check of Hermes source directory via environment variable, when building Android projects 未关闭Android 🤖 good first issue
难度 2/5 1-3 小时 新手友好度 78/100
callstackincubator/react-native-node-api#163 · 1 条评论 ·
-
enhancement good first issue gyp-to-cmake
难度 2/5 1-3 小时 新手友好度 72/100
callstackincubator/react-native-node-api#161 · 3 条评论 · 1 个 reaction ·
-
enhancement Host 🏡
难度 5/5 一周以上 新手友好度 25/100
-
Automatable good first issue
难度 3/5 1-2 天 新手友好度 15/100
callstackincubator/react-native-node-api#424 · 1 条评论 ·
查看 callstackincubator/react-native-node-api 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
bug v2
难度 2/5 1-3 小时 新手友好度 75/100
modelcontextprotocol/inspector#2458 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
难度 2/5 1-3 小时 新手友好度 70/100
carbon-design-system/ibm-products#9907 ·