node.js - node_modules/@types/node/index.d.ts(20,1): error TS1084: Invalid 'reference' directive syntax

标签 node.js typescript compilation tsconfig

我在 typescript 编译方面有问题。 smbd面对过吗?

node_modules/@types/node/index.d.ts(20,1): error TS1084: Invalid 'reference' directive syntax.


tsconfig.json:
{
    "compileOnSave": false,
    "compilerOptions": {
        "sourceMap": true,
        "outDir": "./dist",
        "rootDir": "./app",
        "target": "es6",
        "module": "commonjs",
        "declaration": false,
        "noImplicitAny": false,
        "removeComments": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "listFiles": false,
        "skipLibCheck": true
    },
    "include": [
        "./app/**/*.ts"
    ]
}
package.json中的 typescript 版本:"typescript": "^2.6.1"

最佳答案

有同样的问题。打开文件../node_modules/@types/node/index.d.ts
并删除第三个斜杠

// <reference lib="es2015" />
再次编译

关于node.js - node_modules/@types/node/index.d.ts(20,1): error TS1084: Invalid 'reference' directive syntax,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63720450/

相关文章:

node.js - Sequelize, Typescript - typescript 对模型的 getter 方法产生错误

Angular 4 FormGroup removeControl() 不更新表单

定义为 int 但主体中没有 return 语句的 C 函数仍然可以编译

c - 如何编译这个 Linux 程序?

javascript - Discord.js 等级系统

node.js - Mongo聚合直接返回文档数组

angular - 导航到根路由 "/"

javascript - 如何继续检查数组直到满足特定条件

PHP 5.4.7 编译 ext php_printer

javascript - NodeJS 图像处理/分析可能吗?