尝试启动Discord机器人时,我始终收到错误消息

时间:2020-05-29 15:43:01

标签: discord discord.js

    PS C:\Users\netin\Desktop\bot> node .
internal/modules/cjs/loader.js:1032   
  throw err;
  ^

Error: Cannot find module 'discord.js'
Require stack:
- C:\Users\netin\Desktop\bot\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)       
    at Function.Module._load (internal/modules/cjs/loader.js:898:27)
    at Module.require (internal/modules/cjs/loader.js:1089:19)
    at require (internal/modules/cjs/helpers.js:73:18)
    at Object.<anonymous> (C:\Users\netin\Desktop\bot\index.js:1:17)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'C:\\Users\\netin\\Desktop\\bot\\index.js' ]
}

2 个答案:

答案 0 :(得分:0)

您没有安装discord.js

NPM

npm i discord.js

纱线

yarn add discord.js

答案 1 :(得分:0)

请尝试安装discord.js npm软件包。

NPM

npm install discord.js

npm i discord.js

纱线

yarn add discord.js

有用的链接(参考)

https://discord.js.org/#/

https://www.npmjs.com/package/discord.js

https://github.com/discordjs/discord.js