2016-11-28 45 views
0

我使用vscode此tasks.json文件:打字稿上vscode任务未知选项文件

{ 
    "version": "0.1.0", 
    "command": "tsc", 
    "isShellCommand": true, 
    "args": ["-p", "."], 
    "showOutput": "silent", 
    "problemMatcher": "$tsc" 
} 

VsCode告诉我:

error TS5007: Cannot resolve referenced file: '.'. 
error TS5023: Unknown option 'p' 
Use the '--help' flag to see options. 

这是项目结构:

│ .gitignore 
│ package.json 
│ tsconfig.json 
│ 
├───.vscode 
│  settings.json 
│  tasks.json 
└───src 
    │ configuration.ts 
    │ index.ts 
    │ variables.ts 
    │ 
    ├───api 
    │  api.ts 
    │  UsersApi.ts 
    │ 
    └───model 
      models.ts 

我已经创建了一个公共存储库,以便您可以在那里查看。 Here you can see the files

回答

0

它看起来像任务是拿起tsc的早期版本。我相信在Typescript 1.5中添加了-p标志。

要进行检查,尝试使用以下tasks.json

{ 
    "version": "0.1.0", 
    "command": "tsc", 
    "isShellCommand": true, 
    "args": ["--version"] 
} 

然后检查在输出窗口中vscode:CMDù

这显示哪些打字稿的版本正在已接。

要获得TS的新版本,您可以:

  • 更新您的全球的装机量打字稿的版本:npm install -g typescript
  • 或安装打字稿本地npm install typescript并在tasks.json
+0

使用"command": "./node_modules/typescript/bin/tsc"谢谢@Matt。我不知道为什么系统选择旧版本(1.0.3),因为我全局安装了新版本('npm list -g depth = 0打印出来:打字稿@ 2.0.10'),有什么想法?现在,它告诉我,“。”不是一个可识别的外部命令... – Jordi