#Whimsical error shows up when I run a file

14 messages · Page 1 of 1 (latest)

polar geyser
#

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
tribal trailBOT
#

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. 🦕

polar geyser
#

Alright, what should I do then?

tribal trailBOT
#

🦕💚 I'm glad I was able to help!

polar geyser
daring shell
#

For npm imports, I think you need to prefix with npm: so it would look like
import {things} from "npm:@discordjs/util"

polar geyser
#

WTF

#

vs code made a genious move

#

that's so stupid

#

issue is gone after i fixed it

#

thank you for response anyway

daring shell
#

lol - if it's hosted on NPM, use the npm: prefix. Auto-complete, intellisense, and chatbots are great, trust but always verify.