search

Home  >  Q&A  >  body text

node.js - node express 创建时报错: express.createServer is not a function

node express 创建时TypeError: express.createServer is not a function

安装了Express

//test.js 脚本
var express=require('express');
var app=express.createServer();
app.get('/',function(req,res){
    res.send('welcome to Node Twitter');
})
app.listen(8000);

为什么呀?我这是看书上代码敲的,但是百度到的教程完全不同http://blog.csdn.net/jonahzheng/article/details/33758645

谁能告诉我书上的要怎么弄才对,百度上的又是什么意思?

PHP中文网PHP中文网2923 days ago846

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-17 14:20:12

    What you are looking at should be the very old 2.0 document.
    Your first screenshot shows that 4.14.0 is installed
    So take a look at the official documentation http://expressjs.com/
    or the Chinese translation http://www.expressjs. com.cn/

    reply
    0
  • Cancelreply