2016-10-04 132 views
0

我正在为Angular 2应用程序使用VS代码。编写我的ts文件后,当我尝试编译到JS它不会发生。 JS文件没有被创建。我在上没有错误Ctrl + Shift + B。什么可能导致这个?Ctrl + Shift + B不在Visual Studio代码中编译打印稿代码

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" 
} 

回答

0

我跑命令提示符“TSC”命令来找出它给出了一个错误。 “tsc不被识别为内部或外部命令”。 问题是因为tsc的路径未在环境变量中设置。 所以我在高级系统设置中添加一个新的环境变量:

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

它工作得很好。