gpt4 book ai didi

typescript - node_modules/@types/babel_template/index.d.ts :16:28 - error TS2583: Cannot find name 'Set'

转载 作者:搜寻专家 更新时间:2023-10-30 21:55:37 25 4
gpt4 key购买 nike

我关注了this article设置 TypeScript NPM 包。我第一次运行 npm run build(在安装 jest 之前)。一切顺利。之后,我安装了 jest,然后再次运行 npm run build,我在下面收到一条错误消息:

tsc node_modules/@types/babel__template/index.d.ts:16:28 — error TS2583: Cannot find name ‘Set’. Do you need to change your target library? Try changing the lib compiler option to es2015 or later.

16 placeholderWhitelist?: Set;

Found 1 error.

我的node、npm、tsc版本是:node -v//v8.12.0, npm -v//v6.4.1, tsc -v//v3.4.5

这里是tsconfig.json

{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": true,
"outDir": "./lib",
"strict": false
},
"include": ["./src"],
"exclude": ["node_modules", "**/__tests__/*"]
}

我已经在 tsconfig.json 中排除了“node_modules”,为什么 tsc 仍然运行 node_modules?

最佳答案

就我而言,无论如何我都没有更改项目(在 GIT 更改中看到)。刚刚通过 npm 将 nodejs 安装到 Windows 10 中,并且在编译 ASP.NET 应用程序的 Web 项目时弹出此错误消息(与 node_modules 无关!)。唯一对我有用的解决方案是删除和更新包:

  1. npm i -D @types/node
  2. npm i @types/节点

关于typescript - node_modules/@types/babel_template/index.d.ts :16:28 - error TS2583: Cannot find name 'Set' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57055076/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com