我在全球范围内安装了快递。
我创建了一个名为 helloExpress 的新项目,如下所示:
express helloExpress -c less
安装所有依赖项:
cd helloExpress
sudo npm install
运行应用程序:
node app.js
输出错误:
/home/dev/projects/helloExpress/app.js:1
s., */,,var expr
^
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected token ,
at Module._compile (module.js:429:25)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
at EventEmitter._tickCallback (node.js:192:41)
查看 app.js 的代码,它看起来像这样:
/**, * Module dependencies., */,,var express = require('express'), , routes = require('./routes'), , user = require('./routes/user'), , http = require('http'), , path = require('path');,,var app = express();// all environments,app.set('port', process.env.PORT || 3000);,app.set('views', __dirname + '/views');,app.set('view engine', 'jade');,app.use(express.favicon());,app.use(express.logger('dev'));,app.use(express.bodyParser());,app.use(express.methodOverride());,app.use(app.router);undefined app.use(require('less-middleware')({ src: __dirname + '/public' }));,app.use(express.static(path.join(__dirname, 'public')));,,// development only,if ('development' == app.get('env')) {, app.use(express.errorHandler());,},,app.get('/', routes.index);,app.get('/users', user.list);,,http.createServer(app).listen(app.get('port'), function(){, console.log('Express server listening on port ' + app.get('port'));,});,
如您所见,无处不在。这是一个已知的错误还是我在这里做错了什么?