[英]How to fix “express is not a function”?
I installed express but I have this error 我安装了快递,但出现此错误
var express= require ('express');
var app = express();
var ejs =require('ejs');
var port= 3000
app.get('/',function(req,res,next){
res.render('/form.ejs');
});
app.listen(3000);
module.exports= app;
The version of express you are using is most probably outdated. 您使用的Express版本很可能已经过时。
Remove express": "^<version>"
from package.json and use the following command to install the latest version of express. 从package.json中删除
express": "^<version>"
并使用以下命令安装最新版本的express。
npm install --save express
Or you could also set express": "latest"
in the package.json file and run the command nom install
to install the latest version. 或者,您也可以在package.json文件中设置
express": "latest"
并运行命令nom install
来安装最新版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.