Can't get working in Deno
I've been told Sapphire works in Deno, but when I tried to run my project as-is, I get this error.
![No description](https://cdn.answeroverflow.com/1193004163211202660/Code_o1Hjjw5bF4.png)
Solution:Jump to solution
I'm going to use this message to mark as resovled with @Answer Overflow. The TL;DR is that Deno's node modules compatibility is kind of garbage and the solutions are
- Stick to NodeJS. @vladdy and I are of the opinion that OP's issues with Node can be solved with Node, it just requires some environment setup.
- Use Bun instead of Deno, we fully support it and it does have proper support for node modules....
138 Replies
Does it also run in Node.js?
It works fine with Node
I deleted my old node_modules and dist folders and now it works, but I do see "Warning: Not implemented: ClientRequest.options.createConnection"
Should I be concerned about this?
.....the bot also isn't responding to any commands.
ApplicationCommandRegistries: Took 0ms to initialize.yeah, i think it's looking for javascript files and not properly accounting for typescript files?
also this
![No description](https://cdn.answeroverflow.com/1193063221305815110/Code_EFldCTOLXN.png)
Are you loading TS files directly? I think we might need to add some code for that still but none of us have installed / used deno before to analyse what to add.
Here specifically https://github.com/sapphiredev/pieces/blob/main/src/lib/strategies/LoaderStrategy.ts#L41-L44
For funsies you could try setting that env var mentioned there manually and see what happens
But other than that if you can provide a repro sample then we can add proper deno support
As for djs not exporting LocaleString, that would suggest you're using an outdated version of DiscordJS or Deno does something really weird and ecosystem incompatible with handling s package that re-exports from other packages. LocaleString is re-exported in discordjs from discord-api-types/v10
If you have a package.json (which I do in this case), it uses the module versions in there.
Well is it the latest
14.14.1
sorry i thought that was a statement, not a question. it's
~14.14.1
in package.json
also, i tried setting TS_NODE_DEV. i'm pretty it did load the files, unlike before, since i got a bunch of import errors that i had to fix, but the commands still don't work and it still says it took 0ms to initialize.bump because I want to look into this still
This is where I'm at now. @vladdy we should fix Deno support tbh. No idea yet why it picks up 1 command many times nor why it fails to load CoreReady.
Ugh... Deno support will be hell compared to bun
https://github.com/sapphiredev/pieces/pull/373 at least one thing I noticed
GitHub
fix: add deno to the filters for loading TS files by favna Ā· Pull R...
This is at least one thing that's required, aside from any other issues that need to be fixed to add Deno support.
Did you get the same errors as me @Ruin š² ?
I wonder if the registry is somehow affected or if the piece is just loaded multiple times
If you can get me a minimum repro I can take a look when I'm back
And I've got some time
Also does deno import esm or cjs of our module
ESM
Phew
But does it import esm or cjs of pieces
When you import framework