【问题标题】:/bin/sh: tsc: command not found/bin/sh: tsc: 找不到命令
【发布时间】:2019-04-19 21:54:53
【问题描述】:

我正在使用 Visual Studio Code 来处理 TypeScript。 我创建了 tasks.json 文件以编译 ts 文件,但运行时出现此错误:

/bin/sh: tsc: command not found
The terminal process terminated with exit code: 127

这是我的 tasks.json 文件:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "type": "typescript",
            "tsconfig": "tsconfig.json",
            "problemMatcher": [
                "$tsc"
            ]
        }
    ]
}

有人知道这是什么吗? 我正在使用 Linux Mint。

不重复tsc is not recognized as internal or external command之一 我已经尝试了这些步骤,但没有奏效。

这是我的 tsconfig.json:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "sourceMap": true
    }
}

当我输入 node -v 时使用终端显示: v11.2.0

tsc -v: 版本 3.1.6

【问题讨论】:

  • 嗨叮当,不,它不是重复的。
  • 从引用的副本中,您在 tasks.json 中缺少 .vscode/tasks.json(除其他外)。在您提供准确的信息(例如准确的配置和准确的错误消息)之前,您的问题似乎是重复的。
  • 我添加了更多信息,您认为您需要更多信息吗?

标签: linux angular typescript visual-studio-code linux-mint


【解决方案1】:

二进制文件tsc 似乎不在您的路径中。是否安装了 TypeScript 的软件包?这可能是tsc is not recognized as internal or external command的副本

【讨论】:

  • 嗨 jamie,谢谢,但是如果您意识到版本不同,如果您看到我在这里粘贴的文件内容,则没有命令参数。无论如何,我尝试了您的建议,但没有成功。
  • @EdmarMunhoz 已经通过 npm 安装了打字稿,但是?如果它是在本地而不是全局安装的,则二进制文件的位置可能不在您的路径中。正如另一篇文章中所建议的,您应该尝试运行npm install -g typescript 以全局安装它。
  • 那么您应该尝试其他帖子中的一些其他建议。是的,“命令”键或文件中当前没有的任何内容,但您可以添加它。这几乎肯定是他们在其他帖子中讨论的内容的重复。
猜你喜欢
  • 2021-11-13
  • 2013-05-16
  • 2018-08-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多