简体   繁体   中英

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.

Remove express": "^<version>" from package.json and use the following command to install the latest version of 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM