[英]I keep getting Error: Cannot find module './config.json/'
I am getting this error that from my knowledge, means that it cannot find the file config.json
but when I type the file location directly into the terminal, it opens the file straight away.我收到这个错误,据我所知,这意味着它找不到文件
config.json
但是当我直接在终端中键入文件位置时,它会立即打开文件。
This is the error:这是错误:
PS C:\Users\10730\Downloads\discord.js-tutorials-recon-handler> node .
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module './config.json'
Require stack:
- C:\Users\10730\Downloads\discord.js-tutorials-recon-handler\commands\ticket\ticket.js
- C:\Users\10730\Downloads\discord.js-tutorials-recon-handler\handlers\command.js
- C:\Users\10730\Downloads\discord.js-tutorials-recon-handler\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\10730\Downloads\discord.js-tutorials-recon-handler\commands\ticket\ticket.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\10730\\Downloads\\discord.js-tutorials-recon-handler\\commands\\ticket\\ticket.js',
'C:\\Users\\10730\\Downloads\\discord.js-tutorials-recon-handler\\handlers\\command.js',
'C:\\Users\\10730\\Downloads\\discord.js-tutorials-recon-handler\\index.js'
]
}
I am trying to get this code to work for a Discord bot using discord.js我正在尝试让此代码适用于使用 discord.js 的 Discord 机器人
Thankyou all so much for the help, didn't expect this many people to help me out.非常感谢大家的帮助,没想到这么多人帮我。 :)
:)
There is one /
too much.有一个
/
太多了。 Remove that and it should work:删除它,它应该可以工作:
const config = require('./config.json')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.