Node.js学习6~nodejs报Error: Cannot find module ‘express‘

Posted 秋9

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Node.js学习6~nodejs报Error: Cannot find module ‘express‘相关的知识,希望对你有一定的参考价值。

【现象】

D:\\work\\nodejs\\1helloword>node helloword3.js

node:internal/modules/cjs/loader:936

  throw err;

  ^

Error: Cannot find module 'express'

Require stack:

- D:\\work\\nodejs\\1helloword\\helloword3.js

[90m    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)[39m

[90m    at Function.Module._load (node:internal/modules/cjs/loader:778:27)[39m

[90m    at Module.require (node:internal/modules/cjs/loader:1005:19)[39m

[90m    at require (node:internal/modules/cjs/helpers:102:18)[39m

    at Object.<anonymous> (D:\\work\\nodejs\\1helloword\\helloword3.js:2:15)

[90m    at Module._compile (node:internal/modules/cjs/loader:1101:14)[39m

[90m    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)[39m

[90m    at Module.load (node:internal/modules/cjs/loader:981:32)[39m

[90m    at Function.Module._load (node:internal/modules/cjs/loader:822:12)[39m

[90m    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)[39m

  code: [32m'MODULE_NOT_FOUND'[39m,

  requireStack: [ [32m'D:\\\\work\\\\nodejs\\\\1helloword\\\\helloword3.js'[39m ]

【解决方法】

D:\\work\\nodejs\\1helloword>npm install express

added 50 packages in 2s

以上是关于Node.js学习6~nodejs报Error: Cannot find module ‘express‘的主要内容,如果未能解决你的问题,请参考以下文章

文件系统(node.js学习笔记)

koa-bodyParse 接受post 大表单报错:nodejs Error request entity too large

node.js会很难学吗?

慕课网学习node.js

node.js学习目录

在node.js中使用fs模块复制文件夹报错“no such file or directory, mkdir“