node.js - node express 创建时报错: express.createServer is not a function
PHP中文网
PHP中文网 2017-04-17 14:18:12
0
1
749

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中文网

认证0级讲师

reply all(1)
PHPzhong

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/

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template