在 TypeScript 中接收 getExecuting FilePath 错误

Receiving getExecuting FilePath error in TypeScript

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

Error:Initialization error (typescript). Cannot read property 'getExecutingFilePath' of undefined.

但是,如果我一次执行一个文件,我会收到 "Service is not started"。

这是 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"
]
} 

此外,我注意到我在屏幕右下角看不到 TypeScript 字样:

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

I noticed that if I do a tsc --version from the console, I am getting Version 2.0.2, whereas, if I Preferences -> Languages & Frameworks -> TypeScript, I am getting 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 - 它有帮助吗?