我创建了一个不和谐的机器人,当我尝试运行它时(使用命令node。)

时间:2020-08-27 18:17:21

标签: javascript

它总是提示我找不到模块的错误。我重新安装了node,但是它仍然给我相同的错误,然后我重新安装了discord.js,但是它是相同的。 代码:

const Discord = require('discord.js');
const client = new Discord.Client();

const token = '(actual token here)';

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

client.on('message', msg => {
  if (msg.content === 'ping') {
    msg.reply('Pong!');
  }
});

client.login('token');

错误:

PS C:\Users\Admin> node .
internal/modules/cjs/loader.js:968
 throw err;
 ^

Error: Cannot find module 'C:\Users\Admin'
   at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
   at Function.Module._load (internal/modules/cjs/loader.js:841:27)
   at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
   at internal/main/run_main_module.js:17:47 {
 code: 'MODULE_NOT_FOUND',
 requireStack: []
}

0 个答案:

没有答案