【问题标题】:Typescript file execution using Visual studio code使用 Visual Studio 代码执行 Typescript 文件
【发布时间】:2018-03-18 08:35:12
【问题描述】:

我在执行打字稿文件时遇到了一些问题。我正在使用 Visual Studio 代码来执行打字稿文件。我已经安装并设置了 Visual Studio 代码和打字稿。但是当我尝试执行打字稿文件(tsc filename.ts)时,它会显示错误。请帮忙!

错误:

PS D:\01_Hello> tsc app.ts
tsc : The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ tsc app.ts
+ ~~~
    + CategoryInfo          : ObjectNotFound: (tsc:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

【问题讨论】:

标签: typescript visual-studio-code


【解决方案1】:
  1. https://nodejs.org/en/安装节点js

  2. 从安装nodejs的路径打开cmd并运行npm install -g typescript

  3. 现在到 cmd 上 app.ts 所在的位置运行tsc app.ts

【讨论】:

    【解决方案2】:

    Visual Studio Code 旨在与您通过 NPM 获取的 TypeScript 版本配合使用。所以这里是你需要做的步骤......

    1. 安装节点
    2. 运行npm install -g typescript
    3. 检查它是否与tsc -v 一起使用

    您现在应该一切正常。

    【讨论】:

      猜你喜欢
      • 2012-09-24
      • 2017-02-07
      • 2016-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多