VSCode jsconfig.json 给出 ts 错误指定用于编译的根文件

2024-02-04

我已经在 stackoverflow 上寻找答案了jsconfig.json 给出 ts 错误 https://stackoverflow.com/questions/66868663/jsconfig-json-gives-ts-errors?rq=1。 我试过:

  1. set
"exclude": ["node_modules"]

在 jsconfig.json 中

  1. set
"noEmit": true 

在 jsconfig.json 的“compilerOptions”中

  1. 删除node_moduls和package-lock.json并在npm install之后

npm install --save @types/dotenv

没有任何帮助:(

我只使用 js 文件或 jsx。我的操作系统 ubuntu (Focal Fossa)。有人向我解释错误从何而来。它与 TypeScript 有什么关系?如何彻底摆脱它?除了上面已经做的事情之外,我还能做什么?

完整的错误消息是:

{
    "resource": "path/jsconfig.json",
    "owner": "typescript",
    "severity": 8,
    "message": "File 'path/node_modules/agent-base/dist/src/index' not found.\n  The file is in the program because:\n    Root file specified for compilation",
    "source": "ts",
    "startLineNumber": 1,
    "startColumn": 1,
    "endLineNumber": 1,
    "endColumn": 2
}

您可以在 Visual Studio 中使用以下方法作为解决方法。 文件 > 首选项 > 设置,在搜索栏中输入“typescript validate”,然后取消选中结果。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

VSCode jsconfig.json 给出 ts 错误指定用于编译的根文件 的相关文章

随机推荐