一起学习网 一起学习网


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

网络编程 node.js报错:Cannot find module 'ejs'的解决办法 06-21

发现问题

最近同事问了一个问题,他在用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:WebClientwebstormSpaceday6shuoshuonode_modulesexpresslibview.js:78:30)
  at EventEmitter.render (d:WebClientwebstormSpaceday6shuoshuonode_modulesexpresslibapplication.js:569:12)
  at ServerResponse.render (d:WebClientwebstormSpaceday6shuoshuonode_modulesexpresslibresponse.js:961:7)
  at exports.showIndex (d:WebClientwebstormSpaceday6shuoshuoroutesrouter.js:7:9)
  at Layer.handle [as handle_request] (d:WebClientwebstormSpaceday6shuoshuonode_modulesexpresslibrouterlayer.js:95:5)
  at next (d:WebClientwebstormSpaceday6shuoshuonode_modulesexpresslibrouterroute.js:131:13)

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

解决办法:

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

总结

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

nodejs redis 发布订阅机制封装实现方法及实例代码
nodejsredis发布订阅机制封装最近项目使用redis,对publish和subscribe的使用进行了了解,并进行了封装。varconfig=require('../config/config');varlog=require("./loghelp");var

Node.js用readline模块实现输入输出
什么是ReadlineReadline是Node.js里实现标准输入输出的封装好的模块,通过这个模块我们可以以逐行的方式读取数据流。使用require("readline")可以引用模块。

Node.js连接postgreSQL并进行数据操作
前言PostgreSql是一个面向对象的关系数据库,postgis是一个基于PostgreSql的空间数据库插件,主要用于管理地理空间数据。因此在GIS领域,广泛使用PostgreSql


编辑:一起学习网

标签:模块,是一个,发现,进行了,输入输出