KRusl
KRuslβ€’14mo ago

Whimsical error shows up when I run a file

I'm trying to make a discord bot with Deno and d.js but for some reasons I get this error
error: Relative import path "@discordjs/util" not prefixed with / or ./ or ../
at file:///C:/Users/andri/AppData/Local/deno/npm/registry.npmjs.org/@discordjs/builders/1.6.5/dist/index.d.ts:4:42
error: Relative import path "@discordjs/util" not prefixed with / or ./ or ../
at file:///C:/Users/andri/AppData/Local/deno/npm/registry.npmjs.org/@discordjs/builders/1.6.5/dist/index.d.ts:4:42
10 Replies
Deno AI Helper
Deno AI Helperβ€’14mo ago
The error message you're seeing is related to the way Deno handles module imports. According to the documentation, Deno does not support bare specifiers like @discordjs/util. Instead, you should use a full URL or a relative path. In your case, it seems like the @discordjs/builders package is trying to import the @discordjs/util package using a bare specifier, which is not supported in Deno. If you're using code both with Deno and Node.js, the node: scheme will work in both runtimes and it’s recommended to update to them for your Node.js code. However, this might not be applicable in your case if the discord.js library does not support Deno. You might want to check if there's a version of the discord.js library that's compatible with Deno, or consider using a different library that is compatible with Deno. πŸ¦•
KRusl
KRuslOPβ€’14mo ago
Alright, what should I do then?
Deno AI Helper
Deno AI Helperβ€’14mo ago
πŸ¦•πŸ’š I'm glad I was able to help!
KRusl
KRuslOPβ€’14mo ago
TooFunny
TJBlackman
TJBlackmanβ€’14mo ago
For npm imports, I think you need to prefix with npm: so it would look like import {things} from "npm:@discordjs/util"
KRusl
KRuslOPβ€’14mo ago
BRO
KRusl
KRuslOPβ€’14mo ago
No description
KRusl
KRuslOPβ€’14mo ago
WTF vs code made a genious move that's so stupid issue is gone after i fixed it thank you for response anyway
TJBlackman
TJBlackmanβ€’14mo ago
lol - if it's hosted on NPM, use the npm: prefix. Auto-complete, intellisense, and chatbots are great, trust but always verify.
leemlwando
leemlwandoβ€’12mo ago
Hi team; how do i enable intellisence for npm module sub directories. I have a npm module and i want to be able to access sub folders within that module e.g "npm:myMod/sub/file.ts"

Did you find this page helpful?