简体   繁体   中英

how to fix MODULE NOT FOUND in visual studio code?

So I'm building a discord bot with javascript with node module. after I run with node. command it says MODULE NOT FOUND. how do I fix this? :/

 import { Client } from 'discord.js';
const client = new Client();

const token = 'Token';

client.on('ready', () => {
console.log('This Bot is Online!');
})

client.login(token);

Please try these steps in order, without skipping any.

  1. From the command line, install the discord module
$ npm install discord.js
  1. Run your script
$ node ./index.js
  1. If it doesn't work, run this command to collect debugging info, and share the result with us:
$ less node_modules/discord.js/package.json | grep version

You will have to reinstall "discord.js" for every project or bot.

npm install discord.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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