简体   繁体   English

节点 - 尝试通过键入 node server.js 通过 CLI 运行文件“server.js”,但它显示消息为找不到模块

[英]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.找到我尝试运行该文件的 Visual Studio Code 应用程序。 Things look fine but it says cannot find module.事情看起来不错,但它说找不到模块。 Find my terminal output below along with screenshot in "Node Program"在下面找到我的终端 output 以及“节点程序”中的屏幕截图

    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节点程序

You have to run npm i and then restart your application and vs code.您必须运行npm i然后重新启动您的应用程序和 vs 代码。

Install NPM by typing npm i and then restart your application通过键入 npm i 安装 NPM i 然后重新启动您的应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM