You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

tsconfig.json中extends指定@tsconfig/node20/tsconfig.json无法找到的问题求助

tsconfig.json中extends指定@tsconfig/node20/tsconfig.json无法找到的问题求助

我正在搭建一个新项目,打算用TypeScript(还有ESLint、Prettier和Jest,但这些暂时没那么重要)。跟着教程操作的过程中,在tsconfig.json文件里遇到了错误。

我的项目搭建步骤如下:

yarn init
yarn add typescript
yarn add ts-node @types/node @tsconfig/node20 --dev
touch tsconfig.json

当前的tsconfig.json配置内容是:

{
  "extends": "@tsconfig/node20/tsconfig.json",
  "compilerOptions": {
    "outDir": "./dist",
    "rootDir": "./src",
    "forceConsistentCasingInFileNames": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

现在的问题是,系统无法解析@tsconfig/node20/tsconfig.json,VS Code中悬停这行时会提示错误:File '@tsconfig/node20/tsconfig.json' not found.

我的环境是Mac,使用Yarn 4.5.1,Node版本为v20.18.0(通过nvm安装)。

我在网上没找到相关的解决方案,会不会是Yarn的零安装(zero-installs)特性导致的这个问题呢?我完全按照上面的命令步骤安装了所有依赖,本来以为不会出问题的,现在卡在这里了。

备注:内容来源于stack exchange,提问作者Yorian

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 09:55:31