它总是提示我找不到模块的错误。我重新安装了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: []
}