【问题标题】:Ctrl+Shift+B not compiling typescript code in visual studio codeCtrl+Shift+B 不在 Visual Studio 代码中编译打字稿代码
【发布时间】:2017-02-12 22:37:51
【问题描述】:

我正在为 Angular 2 应用程序使用 VS 代码。在我尝试编译为 JS 时对我的 ts 文件进行编码后,它不会发生。未创建 JS 文件。我在 Ctrl+Shift+B 上没有错误。这可能是什么原因造成的?

PS:tasks.json和launch.json中的配置我已经完成了。

如果我在 CMD 提示符下运行 npm start,它可以正常工作。

这是我的tasks.json:

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": [],
"showOutput": "silent",
"problemMatcher": "$tsc"
}

【问题讨论】:

    标签: angular typescript visual-studio-code tsc


    【解决方案1】:

    我在命令提示符下运行了“tsc”命令,发现它给出了错误。 “tsc 未被识别为内部或外部命令”。 问题是因为 tsc 的路径未在环境变量中设置。 于是我在高级系统设置中添加了一个新的环境变量:

    NAME : "PATH"
    VALUE: "C:\Users\{{your_account}}\AppData\Roaming\npm".
    

    而且效果很好。

    【讨论】:

      猜你喜欢
      • 2020-06-27
      • 2018-07-03
      • 1970-01-01
      • 2016-07-05
      • 1970-01-01
      • 2016-10-20
      • 1970-01-01
      • 1970-01-01
      • 2015-09-19
      相关资源
      最近更新 更多