在TypeScript中接收getExecuting FilePath错误

use*_*300 2 webstorm typescript tsc

我使用WebStorm作为使用转换的TypeScript开发的node.js应用程序.每当我通过从TypeScript选项卡中选择"compile all"运行tsconfig.json时,我会收到以下错误:

错误:初始化错误(打字稿).无法读取未定义的属性'getExecutingFilePath'.

但是,如果我一次执行一个文件,则会收到"服务未启动".

这是tsconfig.json文件:

{
"compilerOptions": {
  "module": "commonjs",
  "target": "ES6",
  "moduleResolution": "node",
  "experimentalDecorators": true,
  "emitDecoratorMetadata": true,
  "types": ["reflect-metadata"],
  "lib": ["ES6"],
  "sourceMap": true,
  "inlineSources": true,
  "pretty": true,
  "outDir": "dist",
  "rootDir": "src",
  "noLib": false,
  "declaration": true
},
"compileOnSave": true,
"include": [
  "src/**/*"
],
"exclude": [
  "node_modules"
]
} 
Run Code Online (Sandbox Code Playgroud)

另外,我注意到我没有看到屏幕右下角的TypeScript字样:

在此输入图像描述

我注意到,如果我tsc --version从控制台执行操作,我将获得2.0.2版,而如果我Preferences -> Languages & Frameworks -> TypeScript,我将获得2.6.2 for WebStorm.如果我从命令行运行tsc它似乎工作,但不是从WebStorm内部.这个问题可能是什么原因?

len*_*ena 6

我注意到,如果我从控制台执行tsc --version,我将获得2.0.2版本,而如果我使用首选项 - >语言和框架 - > TypeScript,我将获得2.6.2 for WebStorm

您已全局安装TypeScript 2.0.2,2.6.2是您的本地项目版本.默认情况下,WebStorm使用项目node_modules中安装的TypeScript.

最有可能的是,您的WebStorm版本不支持TypeScript 2.6.x(此版本包括中断API更改,因此tsserver集成可能会停止工作).请在首选项 - >语言和框架 - > TypeScript中将TypeScript版本更改为Bundled - 它有帮助吗?