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
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....
Jump to solution
141 Replies
RealShadowNova
RealShadowNova•16mo ago
Does it also run in Node.js?
Fayne 🌈🐱 (fka Ruin 🌈🐲)
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?
Favna
Favna•16mo ago
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
Fayne 🌈🐱 (fka Ruin 🌈🐲)
If you have a package.json (which I do in this case), it uses the module versions in there.
Favna
Favna•16mo ago
Well is it the latest 14.14.1
Fayne 🌈🐱 (fka Ruin 🌈🐲)
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.
Favna
Favna•16mo ago
bump because I want to look into this still
Favna
Favna•16mo ago
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.
vladdy
vladdy•16mo ago
Ugh... Deno support will be hell compared to bun
Favna
Favna•16mo ago
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.
Favna
Favna•16mo ago
Did you get the same errors as me @Ruin 🐲 ?
vladdy
vladdy•16mo ago
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
Favna
Favna•16mo ago
ESM
vladdy
vladdy•16mo ago
Phew But does it import esm or cjs of pieces When you import framework
Favna
Favna•16mo ago
esm again
Favna
Favna•16mo ago
GitHub
GitHub - favna/sapphire-deno-repro: A tiny repro for sapphire + deno
A tiny repro for sapphire + deno. Contribute to favna/sapphire-deno-repro development by creating an account on GitHub.
vladdy
vladdy•16mo ago
Ty
Favna
Favna•16mo ago
As for the bottom error that it fails to unload CoreReady, for some reason it tried to unload it twice
vladdy
vladdy•16mo ago
damn, we had the same issue with bun iirc but thats related to the piece being loaded twice we fix that, we fix the error
Fayne 🌈🐱 (fka Ruin 🌈🐲)
Nope. I listed out all the errors I had. Fwiw, I also had issues with i13n ( https://discord.com/channels/737141877803057244/1193004162967928902/1193063221502943372 ), so you may want to add that to the repro repo. Maybe in a different branch so you can focus on base functionality first.
vladdy
vladdy•16mo ago
yeahhh we have the repo above ^ once we fix that, it should all be gud
Fayne 🌈🐱 (fka Ruin 🌈🐲)
Yeah, I was saying to add code for i13n to that repo, probably in a different branch. (also cute PFP o3o) Anyways, I'll try to pull myself away from GTA V to test the latest Sapphire version. Is there a way to have Sapphire output verbose?
Favna
Favna•16mo ago
FYI it's I18n not 13. The 18 refers to the amount of letters between the I and the N in the word internationalisation Likewise it's l10n for localisation and k8s for kubernetes
Favna
Favna•16mo ago
See the src/main.ts in my repo logger config All good. Some people don't know what the number represents so I was making sure.
Fayne 🌈🐱 (fka Ruin 🌈🐲)
i knew what the 18 was. i just didn't bother checking if the number was correct. lol
Fayne 🌈🐱 (fka Ruin 🌈🐲)
deno still doesn't find any commands for me btw
No description
Fayne 🌈🐱 (fka Ruin 🌈🐲)
I did explicitly add "@sapphire/pieces": "^4.2.1" to my package.json
RealShadowNova
RealShadowNova•16mo ago
You will probably need to add resolutions so that framework uses that version.
Favna
Favna•16mo ago
deno deduplicates and symlinks I saw in my repo but you do have to delete node_modules and deno.lock then restart for that
Fayne 🌈🐱 (fka Ruin 🌈🐲)
you can also --unstable-byonm (Bring Your Own Node Modules) to use the packages npm / pnpm installs. btw, should someone pin the repro link? oh. i figured out why it can't find my commands.
Favna
Favna•16mo ago
That doesn't quite explain why I get more errors than you still tho pepeHmm
Fayne 🌈🐱 (fka Ruin 🌈🐲)
I mean, this is Deno reading the command files multiple times for some reason. hmm actually Loaded 1 commands.
Favna
Favna•16mo ago
Well maybe that'll happen for you now as well Yeah that's logged for me too But then it API errors
Fayne 🌈🐱 (fka Ruin 🌈🐲)
actually, it registered commands just fine on my project.
Favna
Favna•16mo ago
pepeHmm
Favna
Favna•16mo ago
Pls share your project tbh
Fayne 🌈🐱 (fka Ruin 🌈🐲)
funny thing is i've been working to make it public. was previously a specialized bot for a single server with a bunch of hardcoded values. granted, idk if the project would work with a new bot. the commands are already registered.
Favna
Favna•16mo ago
I mean thats @Gemboard as well but that didn't stop me from making it open source šŸ‘€
vladdy
vladdy•16mo ago
I love how deno task start just hangs on fetching snowflake
Favna
Favna•16mo ago
Not for me...
vladdy
vladdy•16mo ago
eh, a restart worked also denos lsp does NOT like our sapphire/framework imports wth Relative import path "@sapphire/framework" not prefixed with / or ./ or ../
Favna
Favna•16mo ago
Worked fine for me after adding the plugin and running the bot once to build the modules
Favna
Favna•16mo ago
Might have to reload once
vladdy
vladdy•16mo ago
ye i did restart the LSP
Fayne 🌈🐱 (fka Ruin 🌈🐲)
just published my repo and immediately got this system message
No description
vladdy
vladdy•16mo ago
did you commit your token
Favna
Favna•16mo ago
Lmao published a token
vladdy
vladdy•16mo ago
KEKW
Favna
Favna•16mo ago
Happens to the best of us
Fayne 🌈🐱 (fka Ruin 🌈🐲)
i think it was an old commit
Favna
Favna•16mo ago
Have fun resetting the token
vladdy
vladdy•16mo ago
yep its already reset thats what the system message is for
Favna
Favna•16mo ago
It tells you to obtain a new token not that the current token has been nuked...
Fayne 🌈🐱 (fka Ruin 🌈🐲)
oh fuck the prod bot is broken
vladdy
vladdy•16mo ago
favna pls meguFace
Fayne 🌈🐱 (fka Ruin 🌈🐲)
GitHub
GitHub - RuiNtD/GumroadBot at deno
Contribute to RuiNtD/GumroadBot development by creating an account on GitHub.
Fayne 🌈🐱 (fka Ruin 🌈🐲)
whatever here's the thing
Favna
Favna•16mo ago
Oh
vladdy
vladdy•16mo ago
"our token-scanning gremlins noticed, and have reset your bot's token"
Fayne 🌈🐱 (fka Ruin 🌈🐲)
idek if it works on a new bot. all i tried was on my existing dev bot (with the same commands) and tried renaming one of my commands.
vladdy
vladdy•16mo ago
why tf does it not rebuild if i changed a file
Favna
Favna•16mo ago
Uhm you don't actually use deno if you use pnpm?
vladdy
vladdy•16mo ago
whos that to
Favna
Favna•16mo ago
Ruin
vladdy
vladdy•16mo ago
...oh god so
Fayne 🌈🐱 (fka Ruin 🌈🐲)
deno can use the modules in node_modules
vladdy
vladdy•16mo ago
funny thing
Fayne 🌈🐱 (fka Ruin 🌈🐲)
that's why there's a "byonm" flag in deno.jsonc
Favna
Favna•16mo ago
Yeah but you also don't call deno run You call pnpm
Fayne 🌈🐱 (fka Ruin 🌈🐲)
i just call deno run from CLI.
Favna
Favna•16mo ago
Oh it's not in your package.json like it is for my repo That's what threw me off
Fayne 🌈🐱 (fka Ruin 🌈🐲)
yeah this is a half converted node project
vladdy
vladdy•16mo ago
ok fun fact: deno doesnt cache imports
Fayne 🌈🐱 (fka Ruin 🌈🐲)
i'm trying to use deno because i fucking hate node
vladdy
vladdy•16mo ago
why to both of those statements
Fayne 🌈🐱 (fka Ruin 🌈🐲)
version management and it'd be easier to update prod
Favna
Favna•16mo ago
Maybe try Bun instead? We should definitely support that now
vladdy
vladdy•16mo ago
version management
has nothing to do with node
also
Fayne 🌈🐱 (fka Ruin 🌈🐲)
package management, having to update the packages every time i push to prod
vladdy
vladdy•16mo ago
if you import store from pieces directly, its a different instance than the Store exported from framework wtaf deno not true either
vladdy
vladdy•16mo ago
between npm ci, yarn and pnpm, all support just installing w/e is in the lockfile and strictly that
Favna
Favna•16mo ago
I mean WSL.. But yes that's a pita
vladdy
vladdy•16mo ago
WHY IS WALK GETTING CALLED TWICE ON STORES
Fayne 🌈🐱 (fka Ruin 🌈🐲)
i just prefer being able to git fetch, git pull and just run the updated code
vladdy
vladdy•16mo ago
and you can do that...with node and if you update dependencies you SHOULD manually run the cmd
Favna
Favna•16mo ago
As for package versions, works just fine for me for bots. I use renovate to autobump them then I have a GitHub workflow that pushes a new docker file image and I can (but haven't set it up yet) then also auto restart the prod bot. Fully automated.
vladdy
vladdy•16mo ago
anyways back to the issue at hand walk is called twice register is only called ONCE so w t h
Fayne 🌈🐱 (fka Ruin 🌈🐲)
time to add a shit ton more debugging instead of using breakpoints like a sane person? ĀÆ\_(惄)_/ĀÆ that's what i do no i'm not okay
vladdy
vladdy•16mo ago
oh i dont swing that way, I throw in console.logs in KEKW
vladdy
vladdy•16mo ago
yes favna, sue me
Favna
Favna•16mo ago
I've been tryign to teach vladdy to use breakpoints for years now I still haven't succeeded
vladdy
vladdy•16mo ago
see the thing is I do use breakpoints when I want to I dont want to rn so I dont dont like it dont care didnt ask oh no I see the issue I think oh for FUCK SAKE
vladdy
vladdy•16mo ago
guess what i found
vladdy
vladdy•16mo ago
a nested node modules folder inside framework which has its OWN PIECES VERSION
Fayne 🌈🐱 (fka Ruin 🌈🐲)
of the spaghetti variety perhaps?
Favna
Favna•16mo ago
it's symlinked tho
vladdy
vladdy•16mo ago
Then explain to me why this happened
[STORE] [STORE => arguments] [WALK] Loading all pieces from '/Users/vlad/Development/Sapphire/sapphire-deno-repro/src/arguments'.
[STORE] [STORE => arguments] [WALK] Loading all pieces from '/Users/vlad/Development/Sapphire/sapphire-deno-repro/src/arguments'.
Error
at _CommandStore.loadPath (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:264:17)
at loadPath.next (<anonymous>)
at _CommandStore.loadAll (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:185:24)
at _CommandStore.loadAll (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/framework/dist/esm/lib/structures/CommandStore.mjs:39:17)
at file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/framework/dist/esm/lib/SapphireClient.mjs:78:70
at Array.map (<anonymous>)
at _SapphireClient.login (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/framework/dist/esm/lib/SapphireClient.mjs:78:49)
at main (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/src/main.ts:19:16)
at file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/src/main.ts:28:6
[STORE] [STORE => arguments] [WALK] Loading all pieces from '/Users/vlad/Development/Sapphire/sapphire-deno-repro/src/arguments'.
[STORE] [STORE => arguments] [WALK] Loading all pieces from '/Users/vlad/Development/Sapphire/sapphire-deno-repro/src/arguments'.
Error
at _CommandStore.loadPath (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:264:17)
at loadPath.next (<anonymous>)
at _CommandStore.loadAll (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:185:24)
at _CommandStore.loadAll (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/framework/dist/esm/lib/structures/CommandStore.mjs:39:17)
at file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/framework/dist/esm/lib/SapphireClient.mjs:78:70
at Array.map (<anonymous>)
at _SapphireClient.login (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/framework/dist/esm/lib/SapphireClient.mjs:78:49)
at main (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/src/main.ts:19:16)
at file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/src/main.ts:28:6
the only place that logs that is in Store#loadPath first thing before logging that, I injected a log for the stack and only 1 stacktrace came wait wtf the symlinks are there HOW CAN THERE BE TWO CALLS
Favna
Favna•16mo ago
does deno follow symlinks by default? like how node has --follow-symlinks
vladdy
vladdy•16mo ago
HOW IS LOADPATH BEING CALLED WITH MY INJECTED CODE BUT ALSO NOT WHAT this makes no sense ffs favna did you really setup the debug binary to be HOMEBREW DENO
Favna
Favna•16mo ago
why are you not using homebrew but anyway I just copypastad code from elsewhere lol
vladdy
vladdy•16mo ago
why tf would i use homebrew for a runtime that has its own updater and everything same with bun just use their sh script
Favna
Favna•16mo ago
I would never brew --update && brew --upgrade is too nice
vladdy
vladdy•16mo ago
first off brew upgrade which does both lol
Favna
Favna•16mo ago
I very much treat brew like apt and just use it for like .. nearly everything
vladdy
vladdy•16mo ago
fair oh god the debugger does NOT like our promise.all lol w t f is happening oh thats why its logged twice ok so the double logging is correct and fine oh interesting, we have some core listeners that load twice
Favna
Favna•16mo ago
yeah I noticed that with CoreReady because it got unloaded twice, the second one failing because it's gone already
vladdy
vladdy•16mo ago
but why we had this issue with...cjs being loaded alongside esm but that shouldn't happen
Favna
Favna•16mo ago
maybe paths arent being loaded correctly because of the symlinks? check what paths it tries to load?
vladdy
vladdy•16mo ago
well they are virtual pieces so who tf knows
Favna
Favna•16mo ago
hm
vladdy
vladdy•16mo ago
I'll slap some ddebugs into that also funnily enough not all core pieces dupe just some the loader is called twice ...why why is our _load.mjs called twice
esm load mjs called! Error
at file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/framework/dist/esm/listeners/_load.mjs:12:37
esm load mjs called! Error
at file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/@sapphire/framework/dist/esm/listeners/_load.mjs:12:37
esm load mjs called! Error
at file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/framework/dist/esm/listeners/_load.mjs:12:37
esm load mjs called! Error
at file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/@sapphire/framework/dist/esm/listeners/_load.mjs:12:37
..oh my god wait oh my god wait is it bc we import framework twice???
Favna
Favna•16mo ago
wdym import it twice? that would go handinhand with deno not caching tho
vladdy
vladdy•16mo ago
once in setup, once in main well good news its not that
Favna
Favna•16mo ago
try moving all the setup stuff to mai..
vladdy
vladdy•16mo ago
funn so i moved it all to root
āÆ deno run --allow-all --config ./deno.json src/main.ts
esm load mjs called! Error
at file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/@sapphire/framework/dist/esm/listeners/_load.mjs:14:37
esm load mjs called! Error
at file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/framework/dist/esm/listeners/_load.mjs:14:37
[INFO] Logging in
esm Error
at _ArgumentStore.loadPath (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:264:24)
at loadPath.next (<anonymous>)
at _ArgumentStore.loadAll (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:185:24)
at _SapphireClient.login (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/framework/dist/esm/lib/SapphireClient.mjs:80:19)
at main (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/src/main.ts:38:16)
at file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/src/main.ts:47:6
[ERROR] Error [INCORRECT_TYPE]: The piece 'boolean' is not an instance of 'Argument'.
at _ArgumentStore.resolve (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:212:11)
at _ArgumentStore.unload (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/pieces/dist/esm/lib/structures/AliasStore.mjs:33:24)
at _ArgumentStore.insert (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:233:18) {
type: "INCORRECT_TYPE"
}
āÆ deno run --allow-all --config ./deno.json src/main.ts
esm load mjs called! Error
at file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/@sapphire/framework/dist/esm/listeners/_load.mjs:14:37
esm load mjs called! Error
at file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/framework/dist/esm/listeners/_load.mjs:14:37
[INFO] Logging in
esm Error
at _ArgumentStore.loadPath (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:264:24)
at loadPath.next (<anonymous>)
at _ArgumentStore.loadAll (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:185:24)
at _SapphireClient.login (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/framework/dist/esm/lib/SapphireClient.mjs:80:19)
at main (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/src/main.ts:38:16)
at file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/src/main.ts:47:6
[ERROR] Error [INCORRECT_TYPE]: The piece 'boolean' is not an instance of 'Argument'.
at _ArgumentStore.resolve (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:212:11)
at _ArgumentStore.unload (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/pieces/dist/esm/lib/structures/AliasStore.mjs:33:24)
at _ArgumentStore.insert (file:///Users/vlad/Development/Sapphire/sapphire-deno-repro/node_modules/.deno/@[email protected]/node_modules/@sapphire/pieces/dist/esm/lib/structures/Store.mjs:233:18) {
type: "INCORRECT_TYPE"
}
now it just dies so this must be some deno issues with imports in which case we're le fucked I can fix it at the virtual piece level by..making it a map and not an array, so core pieces with the same name dont duplicate but deno is mega broken
Favna
Favna•16mo ago
It's hell to refactor but maybe do what they do here with deps.ts to cache them?
vladdy
vladdy•16mo ago
i just.. man thats so janky I'll try nop, i completely fucked it now welp
Favna
Favna•16mo ago
tl;dr: use bun instead of deno lol
vladdy
vladdy•16mo ago
or just stick to whats known to work (node) also open an issue about this to their repo.. i doubt they'd fix it but who knows but I have a fix for now weeeellll now it didnt...load commands??? NOW THE DEFAULT BEHAVIOR DOESNT CHANGE
Favna
Favna•16mo ago
are you actually changing stuff or is it flaky lol
vladdy
vladdy•16mo ago
no at this point its just what the repo has and its not setting the mode to bulk overwrite even tho the file is called IT JUST RESET oh my god or its a different context, in which case tough luck holy shit deno
Favna
Favna•16mo ago
it's kind of ironic dont you think that the creator of node rags on about mistakes made with node, then makes deno, and makes it a total clusterfuck
vladdy
vladdy•16mo ago
its because their impl of npm support is a clusterfuck deno itself as a runtime is FINE use it in its ecosystem and you're FINE BUT they half assed the fuck out of node support and here i was moaning that bun was bitchy I dont even know how to describe this behavior to them to ask them to fix it..
Fayne 🌈🐱 (fka Ruin 🌈🐲)
btw this could be related to i18n not working
No description
vladdy
vladdy•16mo ago
Yeah there's not much we can do, their npn support is hella borked We recommend either going bun or just sticking to node
Fayne 🌈🐱 (fka Ruin 🌈🐲)
Did you create a Deno issue?
vladdy
vladdy•16mo ago
.
Solution
Favna
Favna•16mo ago
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.
Anish Shobith P S
Anish Shobith P S•7mo ago
Uhmm, need to open an age old thread. I see no errors, my console just says
āžœ deno task dev
Task dev deno run --watch --allow-all src/index.ts
Watcher Process started.
[INFO] ApplicationCommandRegistries: Initializing...
[INFO] ApplicationCommandRegistries: Took 0ms to initialize.
āžœ deno task dev
Task dev deno run --watch --allow-all src/index.ts
Watcher Process started.
[INFO] ApplicationCommandRegistries: Initializing...
[INFO] ApplicationCommandRegistries: Took 0ms to initialize.
I have a ping command in the commands directory which does not seem to load example from the docs https://sapphirejs.dev/docs/Guide/getting-started/creating-a-basic-app-command Steps I followed to setup the project in deno. Step 1: deno init Step 2: deno add npm:@sapphire/framework npm:[email protected] Step 3: Created src/main.ts. Step 4: Created commands/ping.ts with the above slash command example shared. Step 5: Made a listeners/ready.ts (because earlier the slash command or prefix based command would just not work, I also ensured that loadMessageCommandListeners was enabled when checking via prefix based) Still now it does not emit ready.ts with the message. Minimal Repo Link: https://github.com/anishshobithps/discord-deno-test Note: I have read solutions marked before asking users to use either node or bun but now that deno have released support for npm packages in the v2 I wanted to see if deno is gonna work now.
Favna
Favna•7mo ago
I suspect it's base user directory detection going wrong and you can fix it by adding a package.json file. What does process.cwd() give? See also https://github.com/sapphiredev/pieces/blob/c2105ee9eb890f84e4b1bb2f07630f34893c6a00/src/lib/internal/RootScan.ts#L78
Anish Shobith P S
Anish Shobith P S•7mo ago
I think yeah package.json was probably the culprit here. I fixed by doing the following steps 1. Deleted deno-lock.json , deno.json . 2. Did npm init -y 3. Installed all the required modules 4. Added deno.json back to define tasks Worked fine after this, caused a bit issue when it came to the Deno.env part but adding "deno.enable": true in .vscode/settings.json fixed the issue. Not required but I then just deleted package-lock.json and node_modules and ran deno install and it worked fine after this as well. I have the pushed the working example to the above github repo I linked. Update: Uhmm seems like autocomplete is completely broken, disabling deno.enable gets its back but things like Deno.readFile, Deno.env just throws errors on the editor. Seems like there is no proper fix as of right now. I'll stick to Node for time being.

Did you find this page helpful?