【发布时间】:2016-08-13 09:47:06
【问题描述】:
所以我的 package.json 文件是这样的:
{
"name": "chat_app",
"version": "0.2.0",
"description": "The second iteration of the chat app",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "index.js"
},
"author": "Tino",
"license": "MIT",
"dependencies": {
"express": "^4.14.0",
"jade": "^1.11.0"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-jade": "^1.1.0"
}
}
这是我的 index.js 文件:
var app = require('express')(),
express = require('express'),
http = require('http').Server(app),
jade = require('gulp-jade');
app.use(express.static(path.join(__dirname, '/public')));
app.get('/', function(req, res) {
res.sendfile(__dirname + '/index.html');
})
http.listen(3000, function() {
console.log('listening on localhost:3000');
})
当我输入:node start 时,它不起作用。为什么是这样?非常感谢您的帮助。
谢谢
【问题讨论】:
-
package json 应该是 "start" : "node index"
标签: javascript node.js