Syntax Error, unexpected token m

I need help
17 Replies
d.js toolkit
d.js toolkit15mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
average monarchist fan
my node version is v18.15.0 node index.js node:internal/modules/cjs/loader:388 throw e; ^ SyntaxError: Error parsing C:\Users\HP\Desktop\astralt\package.json: Unexpected token m in JSON at position 254 at parse (<anonymous>) at readPackage (node:internal/modules/cjs/loader:376:42) at readPackageScope (node:internal/modules/cjs/loader:412:19) at shouldUseESMLoader (node:internal/modules/run_main:47:15) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:24) at node:internal/main/run_main_module:23:47 { path: 'C:\Users\HP\Desktop\astralt\package.json' } Node.js v18.15.0 when i try to run the bot, this error pops up
Squid
Squid15mo ago
Your package.json is not in valid JSON format
average monarchist fan
How to fix it? Sry I'm new to that
Squid
Squid15mo ago
Considering that you didn't share your code, all I can do is show you how how it's supposed to look: https://www.json.org/json-en.html
average monarchist fan
I would send the code, but i dont want to reveal token
Squid
Squid15mo ago
You could just replace it with a placeholder before you send the message in discord Also, you shouldn't have a token in your package
average monarchist fan
I didnt mean package Nvm package.json { "name": "astralt", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo "Error: no test specified" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "discord.js": "^14.8.0" } }
Squid
Squid15mo ago
Is that what your code looks like, or does it look like this:
{
"name": "astralt",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"discord.js": "^14.8.0"
}
}
{
"name": "astralt",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"discord.js": "^14.8.0"
}
}
If the former, then you're not escaping the quotes in your test script If the latter, then it works fine for me
average monarchist fan
This Idk where's the problem in index.js Visual Studio Code doesn't show any error I will post index.js without token const { Client, Events, GatewayIntentBits } = require('discord.js'); const { token } = require('./config.json'); const client = new Client({ intents: [GatewayIntentBits.Guilds] }); client.once(Events.ClientReady, () => { console.log('Ready!'); }); client.login(token); Where's the problem? Bump
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
average monarchist fan
There Squid said it looks fine Then idk where is the problem I also sent index.js here I think I did everything right, i don't know why it prevents me from running the bot Did you find any mistakes in both package.json and index.js? So should I show node modules?
average monarchist fan
I saved it with ctrls
d.js docs
d.js docs15mo ago
guide Home: Introduction read more
average monarchist fan
Ok tysm