1

In a tasks.json how can I specify the path for a shell command? I tried:

{
  "label": "launch site local (ngserve)",
  "type": "shell",
  "group": "build",
  "command": "C:/Users/me/npm start",
  "problemMatcher": ["$tsc"]
}

which exited with the error:

/usr/bin/bash: C:/Users/me/npm: No such file or directory The terminal process terminated with exit code: 127

1 Answer 1

2

I realized the command string could hold multiple commands so I chained them using && and did:

{
  "label": "launch site local (ngserve)",
  "type": "shell",
  "group": "build",
  "command": "cd C:/Users/me && npm start",
  "problemMatcher": ["$tsc"]
}

Note that this solution is default shell specific (powershell doesnt handle this well)- I am using Git Bash on windows.

You can change your default shell for a specific command by adding the options param to the task above. The options param looks like this:

Change the path to git bash shell location

  "options": {
    "shell": {
      "executable": "C:\\Windows\\System32\\cmd.exe",
      "args": ["/d", "/c"]
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.