Error bot discord

Question: I have a problem with a bot, it doesn’t respond to commands

Current behavior: Error:

Cannot find module '/home/runner/discord-24x7-music-1/index.js'
Require stack:
- /nix/store/qpnf0dafrfsbcwb4z7cphjm0dff0vl7l-prybar-nodejs-0.0.0-e0d9a52/prybar_assets/nodejs/module-context-hook.js
- /tmp/prybar-nodejs-132150772.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Function.resolve (node:internal/modules/cjs/helpers:109:19)

Desired behavior to put music from a link

Repl link: https://streams.ilovemusic.de/iloveradio5.mp3

code snippet 

Hi @axenteuk123, welcome to the community!

You’re supposed to put the link to your Repl, not the music

1 Like

This error message usually means that node is unable to locate the index.js file in your project directory. Make sure you have the correct location or that index.js is the name of your main file.

And as @QwertyQwerty88 said, provide the link to your Repl.

1 Like
 throw new ERR_INVALID_URL(input);
  ^

TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:393:5)
    at URL.onParseError (node:internal/url:565:9)
    at new URL (node:internal/url:645:5)
    at request (node:https:346:32)
    at Object.get (node:https:394:15)
    at Timeout._onTimeout (/home/runner/discord-24x7-music-1/index.js:11:9)
    at listOnTimeout (node:internal/timers:564:17) {
  input: '',
  code: 'ERR_INVALID_URL'
}

Node.js v18.12.1
repl process died unexpectedly: exit status 1

As the name of the error said

ERR_INVALID_URL

Node.js is trying to parse an invalid URL if you look at the stack trace, the error is occurring in your /home/runner/discord-24x7-music-1/index.js file at line 11, specifically in a setTimeout function’s callback.

You need to ensure that the URL being passed to the get function is valid, like, the URL you’re passing in starts with http:// or https:// .

For example, "www.replit.com" is not a valid URL in Node.js, but "https://www.replit.com" is valid.

2 Likes