【问题标题】:Typescript build Sublime Text 3 on Linux - [Errno 20] Not a directoryTypescript 在 Linux 上构建 Sublime Text 3 - [Errno 20] 不是目录
【发布时间】:2015-08-04 08:02:48
【问题描述】:

尝试在 Ubuntu 上为 Sublime Text 3 构建 TypeScript 构建系统。

运行时

tsc 

在终端上它工作正常。 (打印版本 1.5.0-beta 语法:tsc [options] [file ...])

并且在运行时:

which tsc

上面写着:

/home/antti/npm/bin/tsc

但是,在 ST3 builder 上构建 ts 文件时,它会说:

[Errno 20] Not a directory
[cmd: ['tsc', '/home/antti/code/greeter.ts']]
[dir: /home/antti/code]
[path: /home/antti/npm/bin/tsc]
[Finished]

这是我的 Typescript.sublime-build 配置文件:

{
   "cmd": ["tsc","$file"],
   "file_regex": "(.*\\.ts?)\\s\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(...*?)$",
   "selector": "source.ts",      
}

【问题讨论】:

  • 你看过 github.com/Phaiax/ArcticTypescript 吗?它对 sublime 中的 typescript 开发有很大帮助。它还使用 tsconfig.json 文件,该文件将成为在大多数编辑器中使用 typescript 的“标准”。
  • 确实非常有用的软件包。效果很好。

标签: linux typescript sublimetext sublimetext3


【解决方案1】:

在您的配置文件中定义一个path 键,如下所示:

{
   "cmd": ["tsc","$file"],
   "file_regex": "(.*\\.ts?)\\s\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(...*?)$",
   "selector": "source.ts",
   "path": "/home/antti/npm/bin/"
}

重要的部分不是指向可执行文件 (.../bin/tsc),而是指向目录 (.../bin/)。

【讨论】:

    【解决方案2】:

    在ubuntu中使用- sudo apt-get install nodejs-legacy安装包“nodejs-legacy”

    然后使用

    编辑“usr/local/lib/node_modules/typescript/bin/”中的 tsc 文件的内容
    - sudo gedit /usr/local/lib/node_modules/typescript/bin/tsc
    
    as   #!/usr/bin/env nodejs
    
    require('./tsc.js')
    

    它对我有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-19
      • 2021-04-09
      • 2013-11-05
      • 1970-01-01
      相关资源
      最近更新 更多