Closed Sneaken closed 2 months ago
Is nm_node.js
is set executable?
Is
nm_node.js
is set executable?
yes
chmod +x ./nm_nodejs.js
Make sure the value of "path"
in nm_nodejs.json
is pointing to the absolute path to the file on the file system. Also try with each of the following flags on shebag line removed --max-old-space-size=14 --jitless --expose-gc --v8-pool-size=1
.
Excluding --expose-gc
, which doesn't change anything with regard to node
exiting, while the others can.
Did you update the shebang line in nm_nodejs.js
to point to the absolute path to the node
executable you are using?
#!/usr/bin/env -S /home/user/bin/node --expose-gc --experimental-default-type=module
Did you update the shebang line in
nm_nodejs.js
to point to the absolute path to thenode
executable you are using?#!/usr/bin/env -S /home/user/bin/node --expose-gc --experimental-default-type=module
yes , but no change
#!/usr/bin/env -S /Users/sneaken/.volta/bin/node --expose-gc --experimental-default-type=module
The only other report I have gotten was from another Mac user. I'm running the same code you are running on Linux, Chromium 128.
What happens when you try Deno, Bun, and shell script as Native Messaging hosts?
I tried the official Python code, and it works. This is strange because only Node.js doesn’t work on my computer.
Here are a few Native Messaging hosts that should all send back the same result, an Array
with length
209715
, 1048576
bytes as JSON https://github.com/guest271314/NativeMessagingHosts.
It's probably something like paths not being absolute or files not being executable.
I would reload the extension. Go over the code until you locate the issue. Is node
executable?
This script should work using node
, deno
, or bun
https://github.com/guest271314/NativeMessagingHosts/blob/main/nm_host.js. What happens when you substitute adjust "path"
in nm_nodejs.json
to nm_host.js
, adjust shebang line, make the script executable and run the code?
Here are a few Native Messaging hosts that should all send back the same result, an
Array
withlength
209715
,1048576
bytes as JSON https://github.com/guest271314/NativeMessagingHosts.It's probably something like paths not being absolute or files not being executable.
I would reload the extension. Go over the code until you locate the issue. Is
node
executable?
Error when communicating with the native messaging host.
Here are a few Native Messaging hosts that should all send back the same result, an
Array
withlength
209715
,1048576
bytes as JSON https://github.com/guest271314/NativeMessagingHosts.It's probably something like paths not being absolute or files not being executable.
I would reload the extension. Go over the code until you locate the issue. Is
node
executable?
python can run... my God
Sounds like a path or executable permission issue.
In the last image you posted you are pointing to node
on the shebang. In the other image you pointed to /Users/sneaken/.volta/bin/node
.
Make sure you are pointing to the absolute pathe to node
if node
is not installed system wide.
Sounds like a path or executable permission issue.
sorry, nm_host.js need node 21, when i install it, it can run!!
In theory nm_nodejs.js
should run, too. I'm not sure if pointing to the file descriptors /dev/stdin
and /proc/self/fd/1
is an issue on Mac.
Here are a few Native Messaging hosts that should all send back the same result, an
Array
withlength
209715
,1048576
bytes as JSON https://github.com/guest271314/NativeMessagingHosts.It's probably something like paths not being absolute or files not being executable.
I would reload the extension. Go over the code until you locate the issue. Is
node
executable?
but nm_nodejs.js still like that... MY GOD
In theory
nm_nodejs.js
should run, too. I'm not sure if pointing to the file descriptors/dev/stdin
and/proc/self/fd/1
is an issue on Mac.
I feel like this might be the problem
Although I don’t know what happened, thank you for answering my questions. :)
I don't generally use Apple devices. Thanks for the feedback re Mac and nm_nodejs.js
.
nm_node.js.js
works for me on Linux, with node
and Chromium from tip-of-tree releases fetched today.
I wrote nm_host.js
as a JavaScript runtime agnostic approach to reading standard input and writing to standard output, primarily using WHATWG Streams that is not part of ECMA-262 though works reliably for streaming Uint8Array
s and resizable ArrayBuffer
, with dataView
to read "32-bit message length in native byte order.". Unfortunately, reading standard input and writing to standard output is not standardized in ECMA-262, so it's continual W.I.P. to use the same code across engines and runtimes, e.g., Bun.stdin.stream()
does not beahve the same as Bun.file("/dev/stdin").stream()
.
What happens when you try this code https://github.com/simov/native-messaging/blob/8e99d2a345ae94426a502d05aa5d57b966f6bc78/protocol.js and this code https://github.com/guest271314/NativeMessagingHosts/blob/5306ae8a09f6dd1e8053e737ad244ffd7ca2ecb3/nm_nodejs.mjs?
Although I don’t know what happened, thank you for answering my questions. :)
No worries.
use https://github.com/guest271314/NativeMessagingHosts/blob/5306ae8a09f6dd1e8053e737ad244ffd7ca2ecb3/nm_nodejs.mjs
emmm... haha
Did you remove --max-old-space-size=6
, --jitless
, and --v8-pool-size=1
flags from shebang line?
And if that doesn't change anything, removing process.env.UV_THREADPOOL_SIZE = 1;
and process.stdout._handle.setBlocking(true);
?
this can work https://github.com/simov/native-messaging/blob/8e99d2a345ae94426a502d05aa5d57b966f6bc78/protocol.js
Did you remove
--max-old-space-size=6
,--jitless
, and--v8-pool-size=1
flags from shebang line?And if that doesn't change anything, removing
process.env.UV_THREADPOOL_SIZE = 1;
andprocess.stdout._handle.setBlocking(true);
?
this all no change, maybe should use stream on mac
Thank you once again 😆
use your nm_nodejs.js
chrome.runtime.lastError is 'Native host has exited'.
i don't know what happened.. can you help me?
env: m1 mac node 20 chrome: 126.0.6478.127 arm64