missy
missy
DIAdiscord.js - Imagine an app
Created by missy on 4/20/2024 in #djs-questions
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
2 replies