SyntaxError: C:UsersCizzDesktopbotattempt#4config.json: Unexpected end of JSON input

  javascript, json

Im really new to coding i was interested in coding a discord bot i followed a really new tutorial on youtube, everything worked fine until i wanted to type "node ." in the terminal it keeps giving me this error.

SyntaxError: C:UsersCizzDesktopbotattempt#4config.json: Unexpected end 
of JSON input
    at parse (<anonymous>)
    at Object.Module._extensions..json (internal/modules/cjs/loader.js:1111:22)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)        
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:UsersCizzDesktopbotattempt#4index.js:5:19)    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933


heres the code i ran its just for setting up the bot

const Discord = require('discord.js');

const bot = new Discord.Client();

const { token } = require('./config.json');

bot.on('ready', () => {
    console.log('Bot is Ready!');
})

bot.login(token);


for config.json:

{
    "token": "i changed this because i dont want anyone to use the bot's token"
}```


Source: Ask Javascript Questions

LEAVE A COMMENT