Node-red on Deno 2 & Bun? Well sort-of

Just had a VERY brief play with the Deno 2.0 RC release. Amazingly, Node-RED DOES work!

But is still a little fragile. I got a clean install + UIBUILDER installed and running without any apparent issues. This is a MAJOR step up.

However, trying to run my dev instance resulted in some errors and it didn't work properly.

Note that I installed Deno as per the instructions (very easy) and then upgraded to the canary build with deno upgrade canary.

For those not in the know, Deno is one of 2 current alternatives to Node.js, the other being Bun.

For those people weirdly into TypeScript, Deno can run TS natively, no builds required. v2 of Deno is meant to be fully compatible with Node.js and npm.

For extra fun, I tried the latest production build of Bun as well. And ... blow-me-down! It worked with both my clean+uibuilder instance and my dev instance. Though startup was noticeably slower than node.js.

One minor issue with the dev instance was that I have node-inspector installed and Bun doesn't yet support that. But it gave me a sensible warning and carried on.

Exciting times ahead for server-side JavaScript! :grinning:

I was trying to get this working (with bun), but how do you install nr with bun ?
I have the impression that nr explicitly uses nodejs underwater (when installing with script at least), bun install node-red ?

installed :slight_smile: seems to work ok.

I like bun, because it has a built-in web+websocket server and sqlite, plus more stuff out of the box.
It is nice that there is competition because new versions of nodejs will add certain features from bun and deno now too.

I'm torn, I actually much prefer the route that Deno are taking and it is, of course, backed by the one of the original developers of Node.js. They've some way to go but they already have a very comprehensive standard library and are taking the trouble to be compatible not only with Node.js but also npm. I have my suspicions this one may win out in the end.

I also really like that they've taken the trouble to make most of their standard library cross-compatible with node.js, Bun and the browser. That is very well done.

But Bun got to Node.js compatibility a bit sooner I think. So it seems a little more stable for now. Been running Node-RED on it most of the day with no issues at all.

Deno also has all the things you mention. Though SQLite is an external module. I'm not totally convinced by either websockets implementation since neither offer a browser client that supports their extensions. So no chance of replacing the heavyweight Socket.IO yet. The Bun version though does seem a bit more comprehensive.

Bun is a bit easier to get your head around I think. Deno needs to up their documentation game a little. They've been clever in using JSDoc extensively but then they've let slip a little the narrative documentation that is needed to learn how to use it.

Yes, we are already seeing Node.js pushing to catch up. This competition is much needed.

I was not completely wrong here, during startup (with bun) it takes longer and has an error trying to load the palette, for which it wants to use npm.

npm is embedded in most node.js tooling, Node-RED more than many. But that's OK, that's why both Bun and Deno are striving for interoperability with it. Love it or hate it, there are so many packages that rely on it, it has to be supported.