Deno does not recognize ".node" extension files
[name].node is C++ (kind of) addons compiled for using in Node.JS (as i get it)
It just doesn't allow to run any code with it, since downloading
npm:rosu-pp@0.9.4
with Deno, downloads everything EXCEPT index.node
, but... default npm install rosu-pp
does it, and runs very well, is there something I could do about it?
Reproducing problem can be done with this TypeScript + Deno
chapter in this paste
I tried to run it with different(?) compilers, tsx, node and deno.
- Output
Trying to generate index.node
by yourself doesn't help either, it throws an error require() is not defined
🥺Pastebin
// TypeScript// npx tsx test.tsimport { Calculator } from "rosu-pp"...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
node -v : v18.18.0PS C:\Users\shockpast\Desktop\Codium\test> node...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
3 Replies
I'm sorry for the inconvenience you're experiencing. However, based on the documentation, Deno does not support the use of Node.js C++ addons, which are typically files with the
.node
extension. These files are specific to Node.js and are not compatible with Deno's runtime.
Deno aims to provide a secure runtime for JavaScript and TypeScript, and it operates differently from Node.js. It does not support the require()
function or the loading of native Node.js modules, which includes C++ addons.
While Deno provides some level of compatibility with Node.js through the use of built-in modules via node:
specifiers and the ability to import npm packages using npm:
specifiers, this does not extend to all Node.js features and modules.
If you're trying to use a package that relies on Node.js C++ addons, you might need to look for an alternative package that is compatible with Deno, or consider running your code in a Node.js environment instead. 🦕🦕💚 I'm glad I was able to help!
I figured out by myself, how to do a tricky solution for this, since
rosu-pp
uses Neon for creating bindings from Rust to JavaScript, I visited the npm-registry folder of rosu-pp (that deno created) and simply ran the npm run build -- --release
, that creates index.node into existence. <:party_deno:1035517691517218847>