Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: The typescript task detection didn't contribute a task for the following configuration

I try to put a path in tasks.json for typescript type task:

{
    "version": "2.0.0",
    "tasks": [
        {   
            "identifier": "tsc-client", 
            "label": "tsc-client", 
            "type": "typescript",
            "tsconfig": "src/client/tsconfig.json",
            "problemMatcher": [
                "$tsc"
            ]
        },
        {   
            "identifier": "tsc-server", 
            "label": "tsc-server", 
            "type": "typescript",
            "tsconfig": "src/server/tsconfig.json",
            "problemMatcher": [
                "$tsc"
            ]
        },
        {
            "identifier": "build-all",
            "label": "build-all",
            "dependsOn": ["tsc-client", "tsc-server"]
        }
    ]
}

then in my launch.json I have:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "preLaunchTask": "tsc-client",
            "name": "Launch Program",
            "program": "${workspaceFolder}/server/server-repsic.js"
        }
    ]
}

I lounch it and I obtain:

Error: The typescript task detection didn't contribute a task for the following configuration:
{
    "identifier": "tsc-server",
    "label": "tsc-server",
    "type": "typescript",
    "tsconfig": "src/server/tsconfig.json",
    "problemMatcher": [
        "$tsc"
    ]
}
The task will be ignored.

I check that in the root path I have the src/server/tsconfig.json and src/client/tsconfig.json. Also I type it in the console:

tsc -p src/client/tsconfig.json

and the command works fine.

like image 633
Emilio Platzer Avatar asked Oct 14 '25 15:10

Emilio Platzer


2 Answers

In my case the problem was caused by the fact that VSCode did not read tasks.json on the fly. I.e. I have to restart VSCode when I change tasks.json. After the restart everything works fine. Here is a similar discussion, they say:

There was a problem that the tasks.json didn't get reparsed after a change if not task has been started before. This is fixed for the next releases. However looks like that people get this even without editing the tasks.json.

The comment was added back in 2017, but it looks like the problem with restart is not fixed yet (I have VSCode 1.32.1).

like image 190
Peter Liapin Avatar answered Oct 18 '25 02:10

Peter Liapin


I'm probably a bit late here, but this might help someone else.

I had the exact same issue, and after some tinkering, I solved the problem by replacing forward slash / by double backward slashes \\ in the paths.

For instance, replacing

"tsconfig": "src/server/tsconfig.json",

by

"tsconfig": "src\\server\\tsconfig.json",

disclaimer: I only tested that on Windows. Considering that forward slash is the standard for every other platform, this may not work on other platforms :/.

like image 22
Benjamin Blois Avatar answered Oct 18 '25 04:10

Benjamin Blois