Raphael Ragul
Raphael Ragul

Reputation: 27

Node - Tried to run the file "server.js" through CLI by typing node server.js but it shows message as Cannot find module

Find Visual Studio Code application where I tried to run the file. Things look fine but it says cannot find module. Find my terminal output below along with screenshot in "Node Program"

    F:\Git Clone\Node.js_From 31Oct2019\IBM-Developer\Node.js\Course\Unit-6>node server.js
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'sqlite3'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (F:\Git Clone\Node.js_From 31Oct2019\IBM-Developer\Node.js\Course\Unit-6\utils\utils.js:23:17)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Node Program

Upvotes: 2

Views: 89

Answers (2)

Awais Raza
Awais Raza

Reputation: 63

Install NPM by typing npm i and then restart your application

Upvotes: 0

Pardeep
Pardeep

Reputation: 2283

You have to run npm i and then restart your application and vs code.

Upvotes: 3

Related Questions