-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[napi
] current require()
implement stackTrace
may not correct
#19130
Comments
Perhaps it is related to the missing functionality of importing native Node.js modules. See issue #17246 . |
No, I think core logic behind two issues are totally different. First, I think you made a mistake that testing deno and node without controling variates.
Did you try Node ESM $ node
Welcome to Node.js v18.15.0.
Type ".help" for more information.
> await import('./node_modules/foobar/build/Release/foobar.node')
Uncaught:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".node" for /path/to/node_modules/foobar/build/Release/foobar.node
at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
at new NodeError (node:internal/errors:399:5)
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:79:11)
at defaultGetFormat (node:internal/modules/esm/get_format:121:38)
at defaultLoad (node:internal/modules/esm/load:81:20)
at nextLoad (node:internal/modules/esm/loader:163:28)
at ESMLoader.load (node:internal/modules/esm/loader:605:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22)
at new ModuleJob (node:internal/modules/esm/module_job:64:26)
at #createModuleJob (node:internal/modules/esm/loader:480:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
} That is not supported in Node, which makes it no sense to let deno support it.
No, it is not missing. It is supported, but not perfect. $ deno repl -A
Deno 1.33.3
exit using ctrl+d, ctrl+c, or close()
> var mod = await import('npm:[email protected]/cjs-wrapper.cjs')
undefined
> mod.some_fn('...')
"...ok..." The reason why I say not perfect, is the reason why I open this issue. In node, In deno, should use workaround |
@loynoir excuse me, but I do not understand what you mean by "controling variates". I understand, however, that the bug you report here has nothing to do with #17246 , but is related to the implementation of I did not intentionally try Node ESM import, because I do not want to maintain double-sided code since Deno should make the use of Node.js modules prefixed with I mean, if @bartlomieju says that |
@loynoir any chance you could provide a reproducible example (or a repo) that I could try for debugging this problem? |
@bartlomieju This?
|
Adds support for `npm:bindings` and `npm:callsites` packages because of changes in denoland/deno_core#838. This `deno_core` bump causes us to stop prepending `file://` scheme for locations in stack traces that are for local files. Fixes #24462 , fixes #22671 , fixes #15717 , fixes #19130 , fixes WiseLibs/better-sqlite3#1205 , fixes WiseLibs/better-sqlite3#1034 , fixes #20936 --------- Co-authored-by: Nathan Whitaker <[email protected]>
Given
napi
module[email protected]
contains gyp related code, and js code[email protected]
to private npmActual
Looking for wrong
bindings/1.5.0/build/foobar.node
.detail
Expected
Looking for correct
napi-example/1.0.0/build/foobar.node
.detail
Related
https://github.com/TooTallNate/node-bindings/blob/1.5.0/bindings.js#L82
Workaround
The text was updated successfully, but these errors were encountered: