Ctrl+Shift+B 不编译 visual studio 代码中的打字稿代码
Ctrl+Shift+B not compiling typescript code in visual studio code
我正在为 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"
}
我在命令提示符下运行"tsc"命令发现报错。
"tsc is not recognized as internal or external command"。
问题是因为未在环境变量中设置 tsc 的路径。
所以我在高级系统设置中添加了一个新的环境变量:
NAME : "PATH"
VALUE: "C:\Users\{{your_account}}\AppData\Roaming\npm".
而且效果很好。
我正在为 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"
}
我在命令提示符下运行"tsc"命令发现报错。 "tsc is not recognized as internal or external command"。 问题是因为未在环境变量中设置 tsc 的路径。 所以我在高级系统设置中添加了一个新的环境变量:
NAME : "PATH"
VALUE: "C:\Users\{{your_account}}\AppData\Roaming\npm".
而且效果很好。