为什么打字稿不断给我,在配置文件错误中找不到输入?

发布于 2025-01-28 09:55:36 字数 1300 浏览 2 评论 0原文

Typescript为什么会继续给我在Config File错误中找不到输入?

当我在VS代码中使用tsconfig.json时,但是当我尝试构建它时,它会给我错误。

终端:

error TS18003: No inputs were found in config file '/Users/user/Desktop/projects/ts/.vscode/tsconfig.json'. 
Specified 'include' paths were '["/Users/user/Desktop/projects/ts/mathweb/app.ts"]' and 'exclude' paths were '["/Users/user/Desktop/projects/ts/mathweb/app.ts"]'.


Found 1 error.

The terminal process "zsh '-c', 'tsc -p /Users/user/Desktop/projects/ts/.vscode/tsconfig.json'" failed to launch (exit code: 2).

Terminal will be reused by tasks, press any key to close it.

我搜索了这样,一些答案告诉我创建一个空文件,所以我做到了:

但行不通。其他答案告诉我在tsconfig.json上使用rootdir,我做到了,而且也行不通。

这让我感到困惑。我不熟悉打字稿,我只想将TS编译到指定的目录,这就是现在发生的事情。

我正在使用VSCODE IDE,我不确定这是IDE的问题,还是我的错

Tsconfig.json:

{
"compilerOptions": {

    "outDir": "/Users/user/Desktop/projects/ts/mathweb/app.ts",
    "rootDir": "./mathweb"

},

"include": [
    "/Users/user/Desktop/projects/ts/mathweb/app.ts"
]
,

"exclude": [
    "/Users/user/Desktop/projects/ts/mathweb/app.ts"
]

}

Why does typescript keep giving me the No inputs were found in config file error?

When I use tsconfig.json in VS Code, but when I try to build it, it gives me the error.

Terminal:

error TS18003: No inputs were found in config file '/Users/user/Desktop/projects/ts/.vscode/tsconfig.json'. 
Specified 'include' paths were '["/Users/user/Desktop/projects/ts/mathweb/app.ts"]' and 'exclude' paths were '["/Users/user/Desktop/projects/ts/mathweb/app.ts"]'.


Found 1 error.

The terminal process "zsh '-c', 'tsc -p /Users/user/Desktop/projects/ts/.vscode/tsconfig.json'" failed to launch (exit code: 2).

Terminal will be reused by tasks, press any key to close it.

And I search on SO, and some answer told me to create a empty file, so I did:
enter image description here

But it doesn't work. Other answer told me to use rootDir at tsconfig.json, and I did, and also doesn't work.

It make me confused. I'm not familiar with typescript and I just want ts compile to specified directory, and that is what happened right now.

I'm using vscode ide, I'm not sure if that is IDE's problem,or could also be my fault

tsconfig.json:

{
"compilerOptions": {

    "outDir": "/Users/user/Desktop/projects/ts/mathweb/app.ts",
    "rootDir": "./mathweb"

},

"include": [
    "/Users/user/Desktop/projects/ts/mathweb/app.ts"
]
,

"exclude": [
    "/Users/user/Desktop/projects/ts/mathweb/app.ts"
]

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倚栏听风 2025-02-04 09:55:36

包括期望相对路径so so so so so so so so so

{
"compilerOptions": {

    "outDir": ".",
    "rootDir": "."

},

"include": [
    "./app.ts"
]

}


so you n excrude编辑 中添加了app.ts。
尝试一下

{
    "compilerOptions": {
    
        "outDir": "../dist",
        "rootDir": "."

    },

    "include": [
        "./../mathweb/"
    ]
}

include expects relative path so and you added app.ts in exclude

{
"compilerOptions": {

    "outDir": ".",
    "rootDir": "."

},

"include": [
    "./app.ts"
]

}


Edit: as you don't have tsconfig on root dir
try this

{
    "compilerOptions": {
    
        "outDir": "../dist",
        "rootDir": "."

    },

    "include": [
        "./../mathweb/"
    ]
}

冬天的雪花 2025-02-04 09:55:36

对我而言,我只是关闭“ VS代码编辑器”并重新打开它,并且可以使用&错误已经消失了!!!

For me, I just close the "VS Code Editor" and Re-open it, And It's worked & the error has gone!!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文