[英]'import-resolver-typescript/lib' not found error in jsconfig.json
找不到错误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
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
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"]
}
}
{
"extends": ["next", "next/core-web-vitals"]
}
如果您使用的是 vscode,请尝试禁用TypeScript › Validate
在设置中TypeScript › Validate
。 这为我解决了!
编辑:
找到比完全禁用验证更明智的方法; 在 Vscode 设置中设置 TypeScript SDK
"typescript.tsdk": "./node_modules/typescript/lib"
只需重新启动所有 vscode 窗口,这在我的情况下有效。
也许你还没有为打字稿安装 linter。 您可以使用 npm 全局安装它:
npm i -g eslint-import-resolver-typescript
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.