Discord.js Error: Cannot find module './config.json'

Im trying to call the config.json but it doesn’t find it, the name is what its supposed to be and its in the right place, I really dont know whats wrong.
ERROR LOG:

Error: Cannot find module ‘./config.json’
Require stack:

  • C:\Users\a\Documents\Discord bots\001\commands\botinfo.js
  • C:\Users\a\Documents\Discord bots\001\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object. (C:\Users***\Documents\Discord bots\001\commands\botinfo.js:1:30)
    at Object.Module._extensions…js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19) {
    code: ‘MODULE_NOT_FOUND’,
    requireStack: [
    ‘C:\Users\a\Documents\Discord bots\001\commands\botinfo.js’,
    ‘C:\Users\a\Documents\Discord bots\001\index.js’
    ]
    }

Show us some code, please. If config.json is in the 001 folder and you are calling it from /commands/botinfo, you need to use ../config.json

4 Likes

thx so much that extra dot was the problem! again tysm

2 Likes