Typescript 2.0 未知的编译器错误

Typescript 2.0 unknown compiler error

我遇到了这个错误

    Unknown compiler option 'lib'. (5023)
    Unknown compiler option 'types'. (5023)

我从 node_module 中删除了 typescript 没有用 使用 npm uninstall typescript 和 npm install -g typescript 再次不起作用 使用 npm uninstall -g typescript npm install -g typescript 再次不起作用

有什么想法吗?

你检查过了吗:

  • 启动打字稿的任何文件(例如 package.json 的脚本标签)

  • tsconfig.json 文件?

我觉得其中一个可能设置不正确。这可能吗?

我已将以下内容添加到 InversifyJS docs

Important! InversifyJS requires TypeScript >= 2.0 and the experimentalDecorators, emitDecoratorMetadata, types and lib compilation options in your tsconfig.json file.

仅 TypeScript >= 2.0 支持选项 typeslib

我在使用 Webstorm 时遇到了相同的错误代码。原来我用的不是最新版的Webstorm,我用的是Typescript 1.8。。。安装最新的Webstorm后就没问题了。

尝试安装最新版本的 TypeScript 并重新加载您的解决方案。

编辑 .proj 文件后,tsConfig.json 和其他一些无望的修复,我简单地安装了 Typescript(2.5.2),打开解决方案,'Unknown Compiler Option' 构建错误消失了。