I run the command "node run index.js" but I keep getting met with an error saying:
internal/modules/cjs/loader.js:638 throw err; ^
Error: Cannot find module 'C:\Users\giann\Desktop\Bot\run' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3) 1 Answer
You’re telling node to execute a script called run, with index.js being an argument to run:
Usage: node [options] [ -e script | script.js | - ] [arguments] node inspect script.js [arguments]
You may be confusing npm (which does have a verb called run) and node.
npm run is for executing scripts defined in package.json. It’s not for running files.
tl;dr: You most likely want node index.js.