首页 > 解决方案 > jsconfig.json 给出 ts 错误

问题描述

jsconfig.json在我的根目录中使用Nuxt.js项目。我有一个错误:

File '/home/mike/Documents/nuxt/node_modules/dotenv/types' not found.
  The file is in the program because:
    Root file specified for compilation

实际上第一行有5个错误jsconfig.json错误

我什至没有使用typescript,也没有typescript在创建时设置任何选项Nuxt.js project

jsconfig.json内容:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "~/*": ["./*"],
      "@/*": ["./*"],
      "~~/*": ["./*"],
      "@@/*": ["./*"]
    }
  },
  "exclude": ["node_modules", ".nuxt", "dist"]
}

我不明白他们是从哪里来的。我该如何摆脱这个错误?没有选择quick fix所以我不能ignore errors for entire file

标签: vue.jsvisual-studio-codenuxt.jsvscode-jsconfig

解决方案


在尝试了几种解决方案后,我刚刚添加"exclude": ["node_modules"]并重新启动了 VScode。错误消失了。


推荐阅读