【问题标题】:VS2015: Adding "watch": true to tsconfig.json causing JsErrorScriptException (0x30001)VS2015:向 tsconfig.json 添加“watch”:true 导致 JsErrorScriptException (0x30001)
【发布时间】:2016-12-25 14:20:29
【问题描述】:

我在 VS2015 社区更新 3 版本 14.0.25424.00 中创建了一个虚拟基础项目。 (使用这个很棒的教程:aspnet-core-web-api-angularjs-2)。

这个 angular-2 项目有一些 .ts 文件。

问题:

每次保存文件时都转译(“编译”)为 .js 文件,而是转译 .ts 文件一次且仅在构建时 SERVER-SIDE 项目。 (从 Visual Studio 中单击 F5)。

我用谷歌搜索,发现我应该添加“watch”:true 到 tsconfig.json 文件:

 {
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "module": "system",
    "moduleResolution": "node",
    "watch": true
  },
  "exclude": [
    "node_modules",
    "wwwroot/lib"
  ]
}

但是,现在我在构建时遇到错误: 错误“JsErrorScriptException (0x30001)”。 ASPNETCoreAngular2Demo C:\Visual Studio 2015\Projects\ASPNETCoreAngular2Demo\src\ASPNETCoreAngular2Demo\未知输出1

根据this的帖子,VS2015 update 2中的解决方法是添加到tsconfig文件中:

"compileOnSave": true

但是,这对我的更新 3 版本不起作用。

从 cmd 我运行以下命令:

>tsc -v Version 1.0.3.0

我认为它已经很老了,但我不知道如何更新它,因为正在运行:

>npm install -g typescript@* --save

没有更改当前版本。

你有什么建议? 我很绝望..

TNX,

【问题讨论】:

    标签: visual-studio typescript visual-studio-2015 asp.net-core .net-core-rc1


    【解决方案1】:

    哇,可怜的微软..

    这里的问题是,在安装 VS2015 时,我得到了 TypeScript 1.8, 但它没有更新 Windows 10 的 PATH 环境变量, 所以我其实用的是1.0版本。

    我不得不在 THIS POST 的帮助下手动更新它。

    (注意那里的评论使用“compileOnSave”:在win10 os上为真)。

    现在可以工作了(-;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-27
      • 1970-01-01
      • 2021-10-23
      • 2012-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多