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ā€¢10mo ago
Does it also run in Node.js?
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
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?
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
also this
No description
Favna
Favnaā€¢10mo 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
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
If you have a package.json (which I do in this case), it uses the module versions in there.
Favna
Favnaā€¢10mo ago
Well is it the latest 14.14.1
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
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ā€¢10mo ago
bump because I want to look into this still
Favna
Favnaā€¢10mo 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ā€¢10mo ago
Ugh... Deno support will be hell compared to bun
Favna
Favnaā€¢10mo 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ā€¢10mo ago
Did you get the same errors as me @Ruin šŸ² ?
vladdy
vladdyā€¢10mo 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ā€¢10mo ago
ESM
vladdy
vladdyā€¢10mo ago
Phew But does it import esm or cjs of pieces When you import framework
Favna
Favnaā€¢10mo ago
esm again
Favna
Favnaā€¢10mo 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ā€¢10mo ago
Ty
Favna
Favnaā€¢10mo ago
As for the bottom error that it fails to unload CoreReady, for some reason it tried to unload it twice
vladdy
vladdyā€¢10mo 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
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
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ā€¢10mo ago
yeahhh we have the repo above ^ once we fix that, it should all be gud
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
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ā€¢10mo 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
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
mistype
Favna
Favnaā€¢10mo 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.
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
i knew what the 18 was. i just didn't bother checking if the number was correct. lol
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
deno still doesn't find any commands for me btw
No description
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
I did explicitly add "@sapphire/pieces": "^4.2.1" to my package.json
RealShadowNova
RealShadowNovaā€¢10mo ago
You will probably need to add resolutions so that framework uses that version.
Favna
Favnaā€¢10mo 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
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
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.
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
No description
Favna
Favnaā€¢10mo ago
That doesn't quite explain why I get more errors than you still tho pepeHmm
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
I mean, this is Deno reading the command files multiple times for some reason. hmm actually Loaded 1 commands.
Favna
Favnaā€¢10mo ago
Well maybe that'll happen for you now as well Yeah that's logged for me too But then it API errors
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
actually, it registered commands just fine on my project.
Favna
Favnaā€¢10mo ago
pepeHmm
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
No description
Favna
Favnaā€¢10mo ago
Pls share your project tbh
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
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ā€¢10mo ago
I mean thats @Gemboard as well but that didn't stop me from making it open source šŸ‘€
vladdy
vladdyā€¢10mo ago
I love how deno task start just hangs on fetching snowflake
Favna
Favnaā€¢10mo ago
Not for me...
vladdy
vladdyā€¢10mo 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ā€¢10mo ago
Worked fine for me after adding the plugin and running the bot once to build the modules
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
oh uh
Favna
Favnaā€¢10mo ago
Might have to reload once
vladdy
vladdyā€¢10mo ago
ye i did restart the LSP
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
just published my repo and immediately got this system message
No description
vladdy
vladdyā€¢10mo ago
did you commit your token
Favna
Favnaā€¢10mo ago
Lmao published a token
vladdy
vladdyā€¢10mo ago
KEKW
Favna
Favnaā€¢10mo ago
Happens to the best of us
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
i think it was an old commit
Favna
Favnaā€¢10mo ago
Have fun resetting the token
vladdy
vladdyā€¢10mo ago
yep its already reset thats what the system message is for
Favna
Favnaā€¢10mo ago
It tells you to obtain a new token not that the current token has been nuked...
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
oh fuck the prod bot is broken
vladdy
vladdyā€¢10mo ago
favna pls meguFace
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
GitHub
GitHub - RuiNtD/GumroadBot at deno
Contribute to RuiNtD/GumroadBot development by creating an account on GitHub.
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
whatever here's the thing
Favna
Favnaā€¢10mo ago
Oh
vladdy
vladdyā€¢10mo ago
"our token-scanning gremlins noticed, and have reset your bot's token"
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
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ā€¢10mo ago
why tf does it not rebuild if i changed a file
Favna
Favnaā€¢10mo ago
Uhm you don't actually use deno if you use pnpm?
vladdy
vladdyā€¢10mo ago
whos that to
Favna
Favnaā€¢10mo ago
Ruin
vladdy
vladdyā€¢10mo ago
...oh god so
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
deno can use the modules in node_modules
vladdy
vladdyā€¢10mo ago
funny thing
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
that's why there's a "byonm" flag in deno.jsonc
Favna
Favnaā€¢10mo ago
Yeah but you also don't call deno run You call pnpm
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
i just call deno run from CLI.
Favna
Favnaā€¢10mo ago
Oh it's not in your package.json like it is for my repo That's what threw me off
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
yeah this is a half converted node project
vladdy
vladdyā€¢10mo ago
ok fun fact: deno doesnt cache imports
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
i'm trying to use deno because i fucking hate node
vladdy
vladdyā€¢10mo ago
why to both of those statements
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
version management and it'd be easier to update prod
Favna
Favnaā€¢10mo ago
Maybe try Bun instead? We should definitely support that now
vladdy
vladdyā€¢10mo ago
version management
has nothing to do with node
also
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
package management, having to update the packages every time i push to prod
vladdy
vladdyā€¢10mo ago
if you import store from pieces directly, its a different instance than the Store exported from framework wtaf deno not true either
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
am on windows
vladdy
vladdyā€¢10mo ago
between npm ci, yarn and pnpm, all support just installing w/e is in the lockfile and strictly that
Favna
Favnaā€¢10mo ago
I mean WSL.. But yes that's a pita
vladdy
vladdyā€¢10mo ago
WHY IS WALK GETTING CALLED TWICE ON STORES
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
i just prefer being able to git fetch, git pull and just run the updated code
vladdy
vladdyā€¢10mo ago
and you can do that...with node and if you update dependencies you SHOULD manually run the cmd
Favna
Favnaā€¢10mo 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ā€¢10mo ago
anyways back to the issue at hand walk is called twice register is only called ONCE so w t h
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
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ā€¢10mo ago
oh i dont swing that way, I throw in console.logs in KEKW
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
ayoooooo
vladdy
vladdyā€¢10mo ago
yes favna, sue me
Favna
Favnaā€¢10mo ago
I've been tryign to teach vladdy to use breakpoints for years now I still haven't succeeded
vladdy
vladdyā€¢10mo 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
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
oh no
vladdy
vladdyā€¢10mo ago
guess what i found
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
code?
vladdy
vladdyā€¢10mo ago
a nested node modules folder inside framework which has its OWN PIECES VERSION
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
of the spaghetti variety perhaps?
Favna
Favnaā€¢10mo ago
it's symlinked tho
vladdy
vladdyā€¢10mo 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ā€¢10mo ago
does deno follow symlinks by default? like how node has --follow-symlinks
vladdy
vladdyā€¢10mo 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ā€¢10mo ago
why are you not using homebrew but anyway I just copypastad code from elsewhere lol
vladdy
vladdyā€¢10mo 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ā€¢10mo ago
I would never brew --update && brew --upgrade is too nice
vladdy
vladdyā€¢10mo ago
first off brew upgrade which does both lol
Favna
Favnaā€¢10mo ago
I very much treat brew like apt and just use it for like .. nearly everything
vladdy
vladdyā€¢10mo 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ā€¢10mo ago
yeah I noticed that with CoreReady because it got unloaded twice, the second one failing because it's gone already
vladdy
vladdyā€¢10mo ago
but why we had this issue with...cjs being loaded alongside esm but that shouldn't happen
Favna
Favnaā€¢10mo ago
maybe paths arent being loaded correctly because of the symlinks? check what paths it tries to load?
vladdy
vladdyā€¢10mo ago
well they are virtual pieces so who tf knows
Favna
Favnaā€¢10mo ago
hm
vladdy
vladdyā€¢10mo 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ā€¢10mo ago
wdym import it twice? that would go handinhand with deno not caching tho
vladdy
vladdyā€¢10mo ago
once in setup, once in main well good news its not that
Favna
Favnaā€¢10mo ago
try moving all the setup stuff to mai..
vladdy
vladdyā€¢10mo 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ā€¢10mo ago
It's hell to refactor but maybe do what they do here with deps.ts to cache them?
vladdy
vladdyā€¢10mo ago
i just.. man thats so janky I'll try nop, i completely fucked it now welp
Favna
Favnaā€¢10mo ago
tl;dr: use bun instead of deno lol
vladdy
vladdyā€¢10mo 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ā€¢10mo ago
are you actually changing stuff or is it flaky lol
vladdy
vladdyā€¢10mo 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ā€¢10mo 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ā€¢10mo 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..
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
btw this could be related to i18n not working
No description
vladdy
vladdyā€¢10mo 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
Ruin šŸŒˆšŸ²
Ruin šŸŒˆšŸ²ā€¢10mo ago
Did you create a Deno issue?
vladdy
vladdyā€¢10mo ago
.
Solution
Favna
Favnaā€¢10mo 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ā€¢3w 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ā€¢3w 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ā€¢3w 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.
Want results from more Discord servers?
Add your server