Ctrl+Shift+B在visual studio代码中不编译typescript代码



我在Angular 2应用程序中使用VS代码。编码我的ts文件后,当我试图编译到JS它不会发生。JS文件没有被创建。我在Ctrl+Shift+B上没有错误。是什么原因造成的呢?

PS:我已经在tasks中完成了配置。Json并启动。json。

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

这是我的任务。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"
}

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

NAME : "PATH"
VALUE: "C:Users{{your_account}}AppDataRoamingnpm".

效果很好

最新更新