Rihan
Rihan9mo ago

Certain code prevents Deno from doing anything

Any time I try and use Deno with npm:zeromq@6.0.0-beta.19, running my code has absolutely no output whatsoever, even breaking console.log() at the beginning of the file. I've tried running with a debugger but I get no output there too. This is the module I'm trying to run, which wraps around the C library Libzmq under the hood. https://github.com/zeromq/zeromq.js
// minimal-repro.ts
// deno run --allow-all minimal-repro.ts

import * as zmq from "npm:zeromq@6.0.0-beta.19";

console.log("testing");
const sock = new zmq.Request(); // commenting this out will fix showing "testing" in console
// minimal-repro.ts
// deno run --allow-all minimal-repro.ts

import * as zmq from "npm:zeromq@6.0.0-beta.19";

console.log("testing");
const sock = new zmq.Request(); // commenting this out will fix showing "testing" in console
deno 1.38.3 (release, x86_64-pc-windows-msvc) v8 12.0.267.1 typescript 5.2.2 Edition Windows 11 Pro Version 23H2 Installed on ‎09/‎05/‎2023 OS build 22631.2787 Experience Windows Feature Experience Pack 1000.22681.1000.0
This is my first time with Deno and I think I'm pushing the limits of npm/node compatibility right off the bat. I wanted to use Deno for my assignment to get some experience with it as it really appeals to me over Node.js. I've attached screenshots comparing what happens when I run with/without commenting out the usage of the zeromq library. I'm confused why I'd get no output whatsoever, with console.log() suddenly stop working. Please suggest how I can try and run Deno more verbose/debug logs, or any other recommendations so I can get this working. 🙂
GitHub
GitHub - zeromq/zeromq.js: :zap: Node.js bindings to the ØMQ library
:zap: Node.js bindings to the ØMQ library. Contribute to zeromq/zeromq.js development by creating an account on GitHub.
Usage of zmq lib uncommented
Usage of zmq lib commented out
5 Replies
Deno AI Helper
Deno AI Helper9mo ago
I'm sorry to hear that you're having trouble with Deno and the zeromq library. It's great that you're trying to push the limits and explore Deno's compatibility with npm and Node.js modules. 🦕 From the documentation, it's clear that Deno has made significant strides in supporting npm packages, but it's also noted that this support is experimental and there might be scenarios where something doesn't work as expected. The zeromq library, which you're trying to use, might be one of those cases. The zeromq library is a native Node.js module that provides bindings to the ZeroMQ library. Native modules are particularly challenging because they often rely on Node.js-specific APIs and they require a build step that involves compiling C or C++ code. This is something that Deno doesn't currently support out of the box. The lack of output or error messages is indeed puzzling. One possibility is that the zeromq library or one of its dependencies is causing the Deno process to crash or hang before it has a chance to output anything. To get more information about what's happening, you can try running Deno with the --unstable and --inspect flags. This will enable some unstable APIs and allow you to connect a debugger. Here's how you can do it:
deno run --unstable --inspect --allow-all minimal-repro.ts
deno run --unstable --inspect --allow-all minimal-repro.ts
Then, open chrome://inspect in Chrome or Edge, and click on the "Inspect" link under "Remote Target". This should open a DevTools window where you can see console output, set breakpoints, step through the code, and inspect variables. If this doesn't help, it might be worth reaching out to the Deno community for help. You can do this by opening an issue on the Deno GitHub repository. Be sure to include all the details you've provided here, as well as any
Deno AI Helper
Deno AI Helper9mo ago
additional information you can gather from using the debugger. I hope this helps, and don't hesitate to ask if you have more questions!
marvinh.
marvinh.9mo ago
@Rihan That looks like an issue to me. Can you file an issue here by pasting your message into the text box? https://github.com/denoland/deno/issues/new FYI: I've copied and pasted the messages here into a GH issue https://github.com/denoland/deno/issues/21356 whoops just saw that you've already opened one
Rihan
Rihan9mo ago
Thanks! Sorry for not linking it here earlier. I remembered to do so just now Also, just want to say I love your blog posts! They have been incredibly interesting reads
marvinh.
marvinh.9mo ago
Thanks for the kind words! They're are always fun to write because you always discover something new