![](/img/trans.png)
[英]Error: Cannot find module './config.json' Require stack: [...] {JS}
[英]I keep getting Error: Cannot find module './config.json/'
我收到這個錯誤,據我所知,這意味着它找不到文件config.json
但是當我直接在終端中鍵入文件位置時,它會立即打開文件。
這是錯誤:
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'
]
}
我正在嘗試讓此代碼適用於使用 discord.js 的 Discord 機器人
非常感謝大家的幫助,沒想到這么多人幫我。 :)
有一個/
太多了。 刪除它,它應該可以工作:
const config = require('./config.json')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.