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

发现问题

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

rush:xhtml;"> 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

总结

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

相关文章

这篇文章主要介绍“基于nodejs的ssh2怎么实现自动化部署”的...
本文小编为大家详细介绍“nodejs怎么实现目录不存在自动创建...
这篇“如何把nodejs数据传到前端”文章的知识点大部分人都不...
本文小编为大家详细介绍“nodejs如何实现定时删除文件”,内...
这篇文章主要讲解了“nodejs安装模块卡住不动怎么解决”,文...
今天小编给大家分享一下如何检测nodejs有没有安装成功的相关...