D
D
Dmitry Kuznetsov2021-08-04 16:33:56
webpack
Dmitry Kuznetsov, 2021-08-04 16:33:56

Shows error MODULE_NOT_FOUND, what's the problem?

Good afternoon. There are developments for the bot: https://github.com/Gospodin116/discordjs-bot-ts .

When compiling npm run deveverything is fine. But when I run npm run startit, it throws an error [MODULE_NOT_FOUND].

The error itself :

webpack://ac_community/./node_modules/discord.js/src/client/actions/_sync_^\.\/.*$?:111
                throw e;
                ^

Error: Cannot find module './index.js'
    at webpackContextResolve (webpack://ac_community/./node_modules/discord.js/src/client/actions/_sync_^\.\/.*$?:109:11)
    at webpackContext (webpack://ac_community/./node_modules/discord.js/src/client/actions/_sync_^\.\/.*$?:104:11)
    at new ActionsManager (webpack://ac_community/./node_modules/discord.js/src/client/actions/ActionsManager.js?:13:114)
    at new Client (webpack://ac_community/./node_modules/discord.js/src/client/Client.js?:100:20)
    at eval (webpack://ac_community/./src/index.ts?:2:14)
    at Object../src/index.ts (C:\Dev\Bots\discord\ac_community\dist\index.js:4087:1)
    at __webpack_require__ (C:\Dev\Bots\discord\ac_community\dist\index.js:4518:42)
    at C:\Dev\Bots\discord\ac_community\dist\index.js:4575:37
    at Object.<anonymous> (C:\Dev\Bots\discord\ac_community\dist\index.js:4577:12)
    at Module._compile (node:internal/modules/cjs/loader:1109:14) {
  code: 'MODULE_NOT_FOUND'


I determined that the error started with this method:
client.once('ready', () => {
    console.log('Ready!');
});

But I still don't understand what I'm doing wrong. Tell me please.

PS: TS, Webpack, discordjs are used.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vlad Morkovkin, 2021-08-14
@Vlad808

Most likely, the error does not come from client once ready, because it is a normal listener. The error says that the index.js file was not found. I advise you to run the bot not with npm run start but with node.js.
Also, could you post the full code?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question