网站首页 网站建设 IT知识 IT知识教程 node.js报错:Cannot find module 'ejs'的解决办法

node.js报错:Cannot find module 'ejs'的解决办法

2021-05-26 21:18:18

发现问题

最近同事问了一个问题,他在用node.js的时候,发现node.js报错了,错误显示:

Error: Cannot find module 'ejs' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at new View (d:\WebClient\webstormSpace\day6shuoshuo\node_modules\express\lib\view.js:78:30) at EventEmitter.render (d:\WebClient\webstormSpace\day6shuoshuo\node_modules\express\lib\application.js:569:12) at ServerResponse.render (d:\WebClient\webstormSpace\day6shuoshuo\node_modules\express\lib\response.js:961:7) at exports.showIndex (d:\WebClient\webstormSpace\day6shuoshuo\routes\router.js:7:9) at Layer.handle [as handle_request] (d:\WebClient\webstormSpace\day6shuoshuo\node_modules\express\lib\router\layer.js:95:5) at next (d:\WebClient\webstormSpace\day6shuoshuo\node_modules\express\lib\router\route.js:131:13)

后来通过查找资料,发现原因是因为:没有安装ejs模块

解决办法:

cmd进入到项目目录,安装ejs:npm install --save ejs

总结

以上就是这文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流。

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。 如涉及版权问题,请提交至online#300.cn邮箱联系删除。

以上产品还未完全满足我的所有需求,在下方提交我的专属需求
我的专属需求:
*手机号:
*验证码:
img
咨询报价
现在咨询
img

在线咨询

建站在线咨询

img

微信咨询

扫一扫添加
动力姐姐微信

img
img

TOP