简体   繁体   English

找不到模块'discord.js'

[英]Cannot find module 'discord.js'

When I start my discord bot I get an error on the console:当我启动 discord 机器人时,控制台上出现错误:

internal/modules/cjs/loader.js:834
  throw err;
  ^

Error: Cannot find module 'discord.js'
Require stack:
- /home/container/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/container/index.js:1:17)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/container/index.js' ]
}

But if there is an "index.js"但是如果有一个“index.js”

You need to install discord.js, in your console type npm install discord.js您需要安装 discord.js,在您的控制台类型npm install discord.js

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM