nodejs-执行报错Error: Cannot find module 'express'

栏目: Node.js · 发布时间: 5年前

内容简介:实际上我是有安装express模块的奇了个怪了。
  1. C:\Users\0>node E:\项目\2018年\11月份\nodejs\express_demo.js

  2. module.js:471

  3. throw err;

  4. ^

  5. Error: Cannot find module 'express'

  6. at Function.Module._resolveFilename (module.js:469:15)

  7. at Function.Module._load (module.js:417:25)

  8. at Module.require (module.js:497:17)

  9. at require (internal/module.js:20:19)

  10. at Object. (E:\项目\2018年\11月份\nodejs\express_demo.js:1:77)

  11. at Module._compile (module.js:570:32)

  12. at Object.Module._extensions..js (module.js:579:10)

  13. at Module.load (module.js:487:32)

  14. at tryModuleLoad (module.js:446:12)

  15. at Function.Module._load (module.js:438:3)

  16. C:\Users\0>express --version

  17. 4.16.0

实际上我是有安装express模块的

nodejs-执行报错Error: Cannot find module 'express'

奇了个怪了。

然后试过1种方法是进入项目目录再执行安装express模块,无效

最后,原来是node_modules没有配置环境变量

配置上吧:

1、控制面板\所有控制面板项\系统\高级系统设置\环境变量

新建设‘NODE_PATH’:C:\Users\0\AppData\Roaming\npm\node_modules

nodejs-执行报错Error: Cannot find module 'express'

编辑增加环境变量‘PATH’

nodejs-执行报错Error: Cannot find module 'express'

完美~~

http://www.pianshen.com/article/837378161/


以上所述就是小编给大家介绍的《nodejs-执行报错Error: Cannot find module 'express'》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Algorithms in C, Parts 1-4

Algorithms in C, Parts 1-4

Robert Sedgewick / Addison-Wesley Professional / 1997-9-27 / USD 89.99

"This is an eminently readable book which an ordinary programmer, unskilled in mathematical analysis and wary of theoretical algorithms, ought to be able to pick up and get a lot out of.." - Steve Sum......一起来看看 《Algorithms in C, Parts 1-4》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具