0

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 1

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .