_Originally https://github.com/Microsoft/vscode/issues/36154#issuecomment-336398547_
My task config:
{
"taskName": "lint portal client",
"type": "shell",
"command": "yarn run lint",
"options": {
"cwd": "${workspaceRoot}/user-portal/client"
},
"problemMatcher": {
"base": "$tslint5",
"fileLocation": "absolute"
}
}
In my user settings.json:
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\git-cmd.exe",
"terminal.integrated.shellArgs.windows": [
"--command=usr/bin/bash.exe",
"-l",
"-i"
]
I get this error when I try to run the task:
> Executing task: yarn run lint <
bash: /d: Is a directory
The terminal process terminated with exit code: 126
Workaround is to specify shell for tasks on Windows as suggested by @dbaeumer in https://github.com/Microsoft/vscode/issues/36154#issuecomment-336403892:
"windows": {
"options": {
"shell": {
"executable": "cmd.exe",
"args": ["/d", "/c"]
}
}
},
"tasks" [
{
"taskName": "lint portal client",
"type": "shell",
"command": "yarn run lint",
"options": {
"cwd": "${workspaceRoot}/user-portal/client"
},
"problemMatcher": {
"base": "$tslint5",
"fileLocation": "absolute"
}
}
]
The workaround doesn't seem to work for auto-discovered tasks, e.g., tsc: build still produces
bash: /d: Is a directory
@borekb agree. I need to think what the consequences are if I allow overriding the shell to be used for a contributed task. See https://github.com/Microsoft/vscode/issues/36342
I have a similar Problem but my settings are slightly different. I am using bash.exe directly.
"terminal.integrated.shell.windows": "C:/Program Files/Git/bin/bash.exe"
My task.json looks like this (I am using grunt):
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "grunt",
"task": "build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
},
{
"type": "grunt",
"task": "test",
"group": {
"kind": "test",
"isDefault": true
},
"problemMatcher": "$msCompile"
}
]
}
Terminal Output looks like this:
> Executing task: node_modules\.bin\grunt.cmd test <
/usr/bin/bash: node_modules.bingrunt.cmd: command not found
The terminal process terminated with exit code: 127
Terminal will be reused by tasks, press any key to close it.
Here it can launch the temrinal properly, but it seems that the path to the grunt command is not passed properly to the git bash. Maybe this is a problem of git bash?
Edit: Just tried to use the Windows Subsystem for Linux with
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe"
and got a similar result:
/bin/bash: node_modules.bingrunt.cmd: command not found
Just to bump and add to this, as this issue effects the following guide on the vscode site (it might be worth mentioning on the guide that it also doesn't work for gulp v4?):
https://code.visualstudio.com/docs/languages/css#_transpiling-sass-and-less-into-css
I've tried the workaround that @borekb mentioned of specifying a shell for the task, but it doesn't work at all for me. Disabling all extensions and it's still the same. I've included a git repo that reproduces it here:
https://github.com/RonanQuigley/vscode-tasks-issue
I have the same issue with the path directory not being properly formatted for bash :
Any other suggestions on what could be done? Otherwise I'm stuck using powershell to get it to work.
Edit: this is with VSCode version 1.20.0
Actually, scrap the repo in my prev post. For anyone coming from google or whatever, use this in your tasks.json instead under .vscode and it should work:
{
"version": "2.0.0",
"tasks": [
{
"label": "Gulp",
"command": "gulp",
"args": ["default"], // or whatever the name of your task is that you want from gulpfile.js
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
The issue still stands though, but at least you can continue using bash this way.
I was trying to use bash for windows in order to have better tab auto-completion support then it is in powershell but instead I got the same issue when tried to run a task using Run task command.
Executing task: node_modules.bin\gulp.cmd watch-upload-dev
/bin/bash: /d: No such file or directory
The terminal process terminated with exit code: 127
Also running gulp task in terminal works fine for me.
Upd.
I tried to use cmder as integrated terminal using these settings:
"terminal.integrated.shell.windows": "D:\\tools\\cmder\\cmder.exe",
"terminal.integrated.shellArgs.windows" : ["/K","D:\\tools\\cmder\\vendor\\init.bat"]
Although gulp watch task starts cmder throws a lot of messages connected to missing node_modules.bin\gulp.cmd etc.
Duplicate of #35593
Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.
Happy Coding!
Most helpful comment
Actually, scrap the repo in my prev post. For anyone coming from google or whatever, use this in your tasks.json instead under .vscode and it should work:
{ "version": "2.0.0", "tasks": [ { "label": "Gulp", "command": "gulp", "args": ["default"], // or whatever the name of your task is that you want from gulpfile.js "type": "shell", "group": { "kind": "build", "isDefault": true } } ] }The issue still stands though, but at least you can continue using bash this way.