why do i get module not found if the directory i put for "main" in package.json is correct (i think)
honored.js (a.k.a index.js or bot.js): https://srcb.in/FQImchjC6m
package.json (I am aware some dependencies are missing from this): https://srcb.in/LMd5nXq0OS
package-lock.json: https://srcb.in/GghBvBr9ni
node js version: v20.12.1
discord.js version: v14.14.1 (ran npm list discord.js)
this bot did not originally support slash cmds, and im not planning to add support for it
you can find the bots source code here but i updated it so its a bit different (warning, step 2 is vague so you have to go to individual commands and view the directory thats mentioned so you can move the correct folders to rewrite folder): https://github.com/enlarged/honored-bot
tl;dr: halp š„ŗ
quick/simplified folder & file visual in visual studio (after following README):
HONORED BOT/
ā
āāā honored1/
ā āāā Commands/
ā ā āāā (command folders with respecitve files in em)
ā ā āāā ...
ā ā āāā ...
ā ā
ā āāā honored.js
ā
āāā rewrite/
ā āāā (Util and Database folder with respective files (dont ask me why the original owner didnt just use a db like mongodb, idk either)
ā ā āāā ...
ā ā āāā ...
ā ā
ā āāā (Other bot files)
ā
āāā package-lock.json
āāā package.json
terminal err msg (dw i didnt use real name lol):
node:internal/modules/cjs/loader:451
throw err;
^
Error: Cannot find module 'C:\Users\Hikari\Searches\Favorites\honored-bot\honored.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:443:19)
at Module._findPath (node:internal/modules/cjs/loader:714:18)
at resolveMainPath (node:internal/modules/run_main:26:23)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:24)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
path: 'C:\Users\Hikari\Searches\Favorites\honored-bot\package.json',
requestPath: 'C:\Users\Hikari\Searches\Favorites\honored-bot'
}
Node.js v20.12.1
GitHub
GitHub - enlarged/honored-bot: source codes of lain and honored ( a...
source codes of lain and honored ( ass ). Contribute to enlarged/honored-bot development by creating an account on GitHub.
1 Reply
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ā
Marked as resolved by OP