我正在尝试在 Windows 上编译我的 trypescript 应用程序,使用
C:/nodejs/tsc.cmd --sourcemap app.ts --module
这是我得到的错误:
C:\nodejs\node_modules\typescript\bin\tsc.js:55708
type = type.toLowerCase();
^
TypeError: Cannot call method 'toLowerCase' of undefined
at Object.opts.option.set (C:\nodejs\node_modules\typescript\bin\tsc.js:55708:33)
at OptionsParser.parse (C:\nodejs\node_modules\typescript\bin\tsc.js:55258:36)
at BatchCompiler.parseOptions (C:\nodejs\node_modules\typescript\bin\tsc.js:55771:18)
at BatchCompiler.batchCompile (C:\nodejs\node_modules\typescript\bin\tsc.js:55328:22)
at Object.<anonymous> (C:\nodejs\node_modules\typescript\bin\tsc.js:56015:7)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
理想情况下,它说打字稿库本身存在问题,但这似乎不太可能。
我通过安装打字稿npm instal typescript
,我的版本是0.9.1
,任何帮助将不胜感激。
这是我正在尝试编译的打字稿代码:
///<reference path='node/node.d.ts' />
///<reference path='node/express.d.ts' />
import http = module("http")
import path = module("path")
import express = module("express")
import index = module("./routes/index")
import user = module("./routes/user")
var app = express();
app.configure(function(){
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);
app.use(express.static(path.join(__dirname, 'public')));
});
app.configure('development', function(){
app.use(express.errorHandler());
});
app.get('/', index.index);
app.get('/users', user.list);
http.createServer(app).listen(app.get('port'), function(){
console.log("Express server listening on port " + app.get('port'));
});