VS2015:将“watch”:true添加到tsconfig.json导致JsErrorScriptException(0x30001)

2024-01-12

我创建了一个虚拟基本项目VS2015 社区更新 3,版本 14.0.25424.00。 (使用这个很棒的教程:aspnet-core-web-api-angularjs-2 http://www.talkingdotnet.com/cascading-dropdown-list-aspnet-core-web-api-angularjs-2/ ).

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

问题:

而不是被转译(“编译”)为 .js 文件每次保存文件时,正在转译的 .ts 文件一次且仅在 BUILD 中服务器端项目的时间。 (在 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 https://github.com/Microsoft/TypeScript/issues/7362帖子中,VS2015 update 2中的解决方案是在tsconfig文件中添加:

"compileOnSave": true

然而,这在我的 update 3 版本中对我不起作用。

我从 cmd 运行以下命令:

>tsc -v Version 1.0.3.0

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

>npm install -g typescript@* --save

没有改变当前版本。

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

TNX,


哇,可怜的微软..

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

我必须在以下人员的帮助下手动更新它这个帖子 https://stackoverflow.com/a/35258446/4572425 .

(请注意此处的注释,在 win10 操作系统上使用“compileOnSave”:true)。

现在是工作(-;

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

VS2015:将“watch”:true添加到tsconfig.json导致JsErrorScriptException(0x30001) 的相关文章

随机推荐