Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scripts for Deno

NOTE: Original #17246 was closed, but the issue persists.

To show the different behaviour of Node.js for Windows and Deno for Windows when loading a native addon (Node-API), in particular the node-mdaemon-api addon, which allows Node.js to access the MDaemon's native APIs (an application available exclusively for Windows), here are two scripts showing the correct loading with Node.js and the error with Deno.

Version numbers

C:\deno-issue-17246>node --version
v24.18.0

C:\deno-issue-17246>deno --version
deno 2.9.0 (stable, release, x86_64-pc-windows-msvc)
v8 14.9.207.2-rusty
typescript 6.0.3

C:\deno-issue-17246>

package.json

{
    //...
    "dependencies": {
        "node-mdaemon-api": "^26.0.3-alpha.45"
    }
    //...
}

deno.json

{
  //...
  "imports": {
    "@std/assert": "jsr:@std/assert@^1.0.19",
    "node-mdaemon-api": "npm:node-mdaemon-api@^26.0.3-alpha.45"
  }
}

Node.js: native.js

C:\deno-issue-17246>pnpm start
✓ Lockfile passes supply-chain policies (verified 33m ago)
Lockfile is up to date, resolution step is skipped
Packages: +1
+
Progress: resolved 1, reused 1, downloaded 0, added 1, done

dependencies:
+ node-mdaemon-api 26.0.3-alpha.45

Done in 2s using pnpm v11.7.0
$ node native.js
{
  fileName: '\\\\?\\C:\\deno-issue-17246\\node_modules\\.pnpm\\node-mdaemon-api@26.0.3-alpha.45\\node_modules\\node-mdaemon-api\\node-mdaemon-api.node',
  isPrerelease: true,
  isFreeVersion: true,
  name: 'node-mdaemon-api',
  version: {
    full: '26.0.3-alpha.45',
    major: 26,
    minor: 0,
    release: 3,
    build: 164,
    tag: 'alpha.45'
  }
}

C:\deno-issue-17246>

Deno: native.ts

C:\deno-issue-17246>deno task start
Task start deno run --reload --allow-read --allow-ffi native.ts

C:\deno-issue-17246>

About

Loading native Node module fails with "stream did not contain valid UTF-8"

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages