I’m trying to make a little chatbot for Discord, but there seems to be something wrong with the config file. Whenever I try to get the bot to go online, the console gives me this:
module.js:674
throw err;
^
SyntaxError: /app/config.json: Unexpected token p in JSON at position 13
at JSON.parse ()
at Object.Module._extensions…json (module.js:671:27)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/app/server.js:5:16)
at Module._compile (module.js:652:30)
at Object.Module._extensions…js (module.js:663:10)
could anyone help me? I’m relatively new to Javascript and even more new to Glitch.
That got rid of the error, thank you!! But now when I try to start it on the console, it doesn’t say anything at all. It just skips a line and gives me the $ again. The bot hasn’t gone online.
In the log, it said
node v8.11.4, with pnpm
Installing…
Resolving: total 48, reused 48, downloaded 0
WARN discord.js@11.4.2 requires a peer of bufferutil@^3.0.3 but none was installed.
WARN discord.js@11.4.2 requires a peer of erlpack@discordapp/erlpack but none was installed.
There are about eight of those warnings. I used the “add package” button (there’s a red box with 17? I don’t know what that means) to add all of them, but it’s still not working. Is there something else I’m missing?
Those “Warns” are normal for Installing a package with a discord.js in it but what do you mean the (dollar sign) ? the $ is a git console and works just like a cmd. To START your bot you need to type node bot.js (Replace Bot.js With What Ever File You Have To Start The Bot.)
When you start the console you have to manually type those commands to start your bot.
I don’t think I explained that well enough, oops! But yeah, I know that. I typed ‘node server.js’ and pressed enter, but nothing happened. No error message, nothing.
I just tried it again so I could show a screenshot, and this time I got “(node:28013) Warning: N-API is an experimental feature and could change at any time.” and nothing else.
I added that, but then the error was “parsing error: unexpected token .” I removed the . and then it was “unexpected token catch” I wrote it at the very beginning, should it be somewhere else?
Thank you! It seems like the bot should be online now, but it isn’t? Now this error is showing:
events.js:183
throw er; // Unhandled ‘error’ event
^
Error: listen EADDRINUSE :::3000
at Object._errnoException (util.js:992:11)
at _exceptionWithHostPort (util.js:1014:20)
at Server.setupListenHandle [as _listen2] (net.js:1355:14)
at listenInCluster (net.js:1396:12)
at Server.listen (net.js:1480:7)
at Function.listen (/rbd/pnpm-volume/7d309165-e155-4cdd-b6b1-c8d7401d2570/node_modules/.registry.npmjs.org/express/4.16.3/node_modules/express/lib/
application.js:618:24)
at Object. (/app/server.js:12:5)
at Module._compile (module.js:652:30)
at Object.Module._extensions…js (module.js:663:10)
at Module.load (module.js:565:32)
Yes, but how would I change the port number so it would work on any server?
When I activate the bot from my computer’s console (and the code is in the computer’s files), I don’t need to include the port anywhere in the code and it works just fine on multiple servers at once.
im having the same issue too /rbd/pnpm-volume/133c3dba-5123-47df-b953-74c620c4dfa7/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/client/Client.js:41
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions…js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/rbd/pnpm-volume/133c3dba-5123-47df-b953-74c620c4dfa7/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/index.js:8:11)