gpt4 book ai didi

javascript - 在 jsconfig.json 中找不到“import-resolver-typescript/lib”错误

转载 作者:行者123 更新时间:2023-12-05 00:24:54 25 4
gpt4 key购买 nike

问题:
错误 File '/Users/nish7/Documents/Code/WebDev/HOS/frontend/node_modules/eslint-import-resolver-typescript/lib' not found. The file is in the program because: Root file specified for compilation繁殖步骤:

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

  • 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

  • 注意:我添加了 eslint-import-resolver-typescript 模块,但仍然有效。
    截屏:
    SS

    最佳答案

    如果您使用的是 vscode,请尝试禁用 TypeScript › Validate在设置中。这为我解决了!
    编辑:
    找到比完全禁用验证更明智的方法;在 Vscode 设置中设置 TypeScript SDK"typescript.tsdk": "./node_modules/typescript/lib"

    关于javascript - 在 jsconfig.json 中找不到“import-resolver-typescript/lib”错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68178438/

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