简体   繁体   English

我不断收到错误:找不到模块'./config.json/'

[英]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.非常感谢大家的帮助,没想到这么多人帮我。 :) :)

Folder Tree文件夹树

There is one / too much.有一个/太多了。 Remove that and it should work:删除它,它应该可以工作:

const config = require('./config.json') 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:找不到模块 './config.json' 需要堆栈:[...] {JS} - Error: Cannot find module './config.json' Require stack: [...] {JS} 找不到模块“./config.json” - Cannot find module './config.json' 我不断收到以下错误:“错误:找不到模块'./framer'” - I keep getting the following error: “Error: Cannot find module './framer'” 错误 - 找不到模块“config” - Error - Cannot find module 'config' 尝试在 nextjs 应用程序中添加 `babel.config.js` 时出现`Cannot find module '.next\server\pages-manifest.json'` 错误 - Getting `Cannot find module '.next\server\pages-manifest.json'` error when trying to add `babel.config.js` in nextjs app 从 Config.Json、Journey Builder、Marketing Cloud 获取 InArguments - Getting InArguments from Config.Json, Journey Builder, Marketing Cloud 为什么我总是抛出这个错误? 节点:内部 /modules /cjs/ loader 944 Throw Err ^(找不到模块) - Why do I keep getting throwing this error? node : internal /modules /cjs/ loader 944 Throw Err ^ (Cannot find module) 错误:ENOENT:没有这样的文件或目录,打开“../config.json” - Error: ENOENT: no such file or directory, open '../config.json' .env 与配置 json - .env vs config.json 运行时错误:找不到模块“./config” - Runtime Error: Cannot find module “./config”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM