RileCraft / DiscordBot-Template

A bot template with command , event , button , selectmenus , slashcommands handler and error handlers. Made in Discord.JS V14
MIT License
229 stars 59 forks source link

[ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:' #82

Closed GoldO-dev closed 8 months ago

GoldO-dev commented 8 months ago

Describe the issue When trying to install the newest version I get a ERR_UNSUPPORTED_ESM_URL_SCHEME error. I just followed the install guide in the readme

To Reproduce Steps to reproduce the behavior:

  1. Download the zip file from releases or from github with the code button
  2. Extract the zip file
  3. Open the folder
  4. Open a new terminal (If using VS Code)
  5. Type npm install
  6. Open the src folder
  7. Open the config.js file
  8. Change "Bot Prefix" to the prefix you want (I typed "!")
  9. Change "Bot Token" to your bot's token
  10. Change "Bot Owner Discord ID" to you discord ID
  11. Type node . in the terminal

Expected behavior I would extect the bot to start, but I got an error.

Screenshots Screenshot of the error: ERR_UNSUPPORTED_ESM_URL_SCHEME error Screenshot of my package.json file: Package json file Screenshot of the return I got when I ran the npm install command (I know it can't be used to anything but attached it anyway): npm install return

Host Details:

RileCraft commented 8 months ago

Can you try node bot.js

GoldO-dev commented 8 months ago

Can you try node bot.js

I got the same error. image

RileCraft commented 8 months ago

In the bot.js file where const __dirname is, just put the value import.meta.url and see if it works

GoldO-dev commented 8 months ago

In the bot.js file where const __dirname is, just put the value import.meta.url and see if it works

It didn't give any error, and the bot started, but the /ping doesn't work, same with the !ping

image image image

RileCraft commented 8 months ago

I have found a solution and will shortly push the fix.

GoldO-dev commented 8 months ago

Thanks. Appreciate the quick work.

Is there some docs for the template some where?

GoldO-dev commented 8 months ago

With docs I'm refering to a gitbook or something like that, so you don't need to click on the links every time. (I know there is docs in the readme but a gitbook would be nice)

RileCraft commented 8 months ago

I have pushed the update to Unstable branch and let me know if it works for you now. I might consider gitbook or something else but a non-priority right now.

GoldO-dev commented 8 months ago

I have pushed the update to Unstable branch and let me know if it works for you now. I might consider gitbook or something else but a non-priority right now.

Okay, will test it when I'm home in about 45 minutes.