在 jsconfig.json 中找不到“import-resolver-typescript/lib"错误 [英] 'import-resolver-typescript/lib' not found error in jsconfig.json

查看:28
本文介绍了在 jsconfig.json 中找不到“import-resolver-typescript/lib"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误 找不到文件'/Users/nish7/Documents/Code/WebDev/HOS/frontend/node_modules/eslint-import-resolver-typescript/lib'.该文件在程序中,因为:指定编译的根文件

  • 创建下一个应用程序
  • npx jsconfig.json -t nextjs

jsconfig.json

jsconfig.json

    "compilerOptions": {
        "checkJs": false,
        "resolveJsonModule": true,
        "moduleResolution": "node",
        "target": "es2020",
        "module": "es2015",
        "baseUrl": ".",
        "paths": {
            "@/components/*": ["components/*"],
            "@/styles/*": ["styles/*"],
            "@/pages/*": ["pages/*"],
            "@/utils/*": ["utils/*"],
            "@/theme/*": ["theme/*"]
        }
    },
    "exclude": [
        "dist",
        "node_modules",
        "build",
        ".vscode",
        ".next",
        "coverage",
        ".npm",
        ".yarn"
    ],
    "typeAcquisition": {
        "enable": true,
        "include": ["react", "react-dom"]
    }
}


eslint.rc

{
  "extends": ["next", "next/core-web-vitals"]
}

规格

  • vscode:版本 1.57.1​​
  • 节点:14.17.1 (LTS)
  • nextjs:11.0.1
  • 推荐答案

    如果您使用的是 vscode,请尝试在设置中禁用 TypeScript › Validate.这为我解决了!

    If you are using vscode, try to disable TypeScript › Validate in settings. This solved it for me!

    找到了比完全禁用验证更明智的方法;在 Vscode 设置中设置 TypeScript SDK

    Found a more sensible approach than totally disabling validation; setting the TypeScript SDK in the Vscode setting

    typescript.tsdk":./node_modules/typescript/lib"

    这篇关于在 jsconfig.json 中找不到“import-resolver-typescript/lib"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆