2015-09-15 182 views
1

已安裝的Visual Studio 2015中,將TypeScript文件添加到現有的項目文件夾中。文件看起來像這樣(從Telerik的樣品):Visual Studio 2015中的TypeScript編譯錯誤

interface Book { 
    title: string; 
    author: string; 
    bookInfo:() => string; 
} 

var b: Book = { 
    title: 'Moby Dick', 
    author: 'Herman Melville', 
    bookInfo: function() { 
     return this.title + " by : " + this.author; 
    } 
} 

var book = b.bookInfo(); 
alert(book); 

在構建解決方案,我得到了一個錯誤:

嚴重性:錯誤 說明:自動化服務器不能創建對象
項目:PROJECT1
文件:VSTSC

推門進去,開發商命令提示符下VS2015跑TSC只是爲了看看會回來:

C:\Tfs\Project1\Scripts\app>tsc tsc.js(703, 13) JavaScript runtime error: Automation server can't create object

與Visual Studio 2015中的消息相同。

不確定TypeScript編譯器出現什麼問題。我確實通過工具>擴展和更新來安裝TypeScript 1.5.4。

我的下一步應該是什麼?

回答

1

它看起來像一個衆所周知的問題。考慮this link

+0

是的,我在那裏查看和每個鏈接,它只支持Windows 2000和XP。我正在運行Windows 7 SP1。 –

+0

我不知道...嘗試用[** gulp **](https://www.npmjs.com/package/gulp-typescript)或類似的東西編譯你的代碼。也嘗試發佈你的問題[官方github線程](https://github.com/Microsoft/TypeScript/issues/new) –

1

windows(非節點版本)上的默認tsc使用IE的JavaScript引擎來執行JavaScript。

From here:

The simple solution may be to reset your IE security settings to the default Medium-high setting

而且禁用您在IE中安裝任何第三方Active X組件。

+0

這不適合我,我也試圖改變它在很多方面 – deadManN