When trying to run an nrepl server with deno and cider, I get a sync nrepl request timed out Any ideas why?
must be something to do with the imports: when using --unstable-node-globals it seems to work.
Which version of node ?
When upgrading to a still supported LTS version it should work
deno π
Ah
(it's me again π )
Then probably thereβs something in the code of the nrepl server still relying on node
it's complaining that buffer is imported without node: prefix. However, I couldn't spot that code in the nbb repo
how to reproduce this? I couldn't get the nrepl server working on deno yet, it's af it's blocking or buffering something which makes the output not appear
β’ start nrepl with deno run -A jsr:@babashka/nbb nrepl-server
β’ connect with cider (normal, like in readme)
I have tried: lein repl :connect 49565 which is just stuck. works with node
I've also seen behavior in bun not working well with networking code with the same code that works in node
then I ran an eval command in emacs, just a moment
the error showed up in the console
In emacs I get "sync nREPL request timed out"
try with the unstable flag
where do I put the flag?
deno -A --unstable-node-globals jsr:@babashka/nbb nrepl-server
just works now!
eval in emacs I mean
(cider-nrepl-sync-request:eval "(+ 1 2)")
lein repl :connect 50167
doesn't work thoughthis is what gave me the buffer error
nREPL server started on port 42183 on host 127.0.0.1 - <nrepl://127.0.0.1:42183> error: Uncaught (in promise) ReferenceError: Buffer is not defined at a6 (https://jsr.io/@babashka/nbb/1.3.201/lib/nbb_nrepl_server.js:27:70) at https://jsr.io/@babashka/nbb/1.3.201/lib/nbb_nrepl_server.js:28:62 at https://jsr.io/@babashka/nbb/1.3.201/lib/nbb_core.js:986:363 at https://jsr.io/@babashka/nbb/1.3.201/lib/nbb_core.js:986:376 at ch (https://jsr.io/@babashka/nbb/1.3.201/lib/nbb_core.js:95:304) at $http://APP.bh.$APP.g.fa (https://jsr.io/@babashka/nbb/1.3.201/lib/nbb_core.js:868:22) at Object.$APP.u (https://jsr.io/@babashka/nbb/1.3.201/lib/nbb_core.js:67:94) at Object.$APP.lh (https://jsr.io/@babashka/nbb/1.3.201/lib/nbb_core.js:97:74) at Oh.$APP.Oh.h (https://jsr.io/@babashka/nbb/1.3.201/lib/nbb_core.js:890:66) at a6 (https://jsr.io/@babashka/nbb/1.3.201/lib/nbb_nrepl_server.js:27:437) info: Buffer is not available in the global scope in Deno. hint: Import it explicitly with import { Buffer } from "node:buffer";, or run again with --unstable-node-globals flag to add this global.
is lein still a thing?
haha yes it is still a thing
which version of deno do you have?
I'm also getting some Unhandled operation :version
but that might be normal for nbb, haven't cidered much into it upto now
js/Deno.version => #js {:deno "2.3.1", :v8 "13.5.212.10-rusty", :typescript "5.8.3"}
deno 2.2.9 (stable, release, x86_64-unknown-linux-gnu) v8 13.5.212.10-rusty typescript 5.7.3
Perhaps you can try to decompile the code a bit where Deno is pointing at
could be that it's coming from a dependency
will do
did you ever get sourcemaps to work with nbb?
ah yes, it's from the bencode implementation:
(defn utf8-bytes [s]
(.-length (js/Buffer.from s)))I haven't tried
I'll try with node:buffer
same results as without it but perhaps for me the difference is node 2.3.1 instead of your 2.3.1
happy to just commit this though. meanwhile you could try an upgrade
of deno
This PR doesn't work. Maybe js/Buffer and node:buffer are not the same?
> var x = require("node:buffer")
undefined
> js/Buffer.from
Uncaught ReferenceError: js is not defined
> Buffer.from
[Function: from]
> x.from
undefinedI'll get rid of Buffer altogether in this code
even better π
about deno update: I'm using arch linux. I'm a bit reluctant to upgrade packages outside of the package manager
ok
amazing, lein works now:
$ lein repl :connect 54355
Connecting to nREPL at 127.0.0.1:54355
Could not resolve symbol: nrepl.core/version
user=> (+ 1 2 3)
61.3.202 is now being published on CI, should be there once CI finishes
great, thanks!
ok, it's there now
$ time npx nbb@1.3.202 -e '(+ 1 2 3)'
6
npx nbb@1.3.202 -e '(+ 1 2 3)' 0,28s user 0,08s system 78% cpu 0,463 total
$ time bun x nbb@1.3.202 -e '(+ 1 2 3)'
6
bun x nbb@1.3.202 -e '(+ 1 2 3)' 0,07s user 0,02s system 98% cpu 0,091 total
$ time deno -A jsr:@babashka/nbb@1.3.202 -e '(+ 1 2 3)'
6
deno -A jsr:@babashka/nbb@1.3.202 -e '(+ 1 2 3)' 0,06s user 0,02s system 113% cpu 0,067 total