VS Code integrated terminal error while running `npm version patch`

Viewed 124

I run the command npm version patch in the integrated terminal in VS Code and it fails to run it and this is the log:

'add',
info git   'C:\\Users\\User\\source\\repos\\ 
 client\\src\\quickapp\\clientapp\\package.json

'add',
info git   'C:\\Users\\User\\source\\repos\\ 
 client\\src\\quickapp\\clientapp\\package-lock.json

info git [ 'commit', '-m', '1.12.9' ]

It tries to stage the files using their full path without success, and when it comes to the commit part it fails because the files are not staged.

When I run the command from the integrated terminal like this: git add package.json it works as expected but with the full path it doesn't.

More Information: When I run npm version patch from git bash it works fine.
What VS Code settings am I missing here?

5 Answers

In VSCode type ctrl+shift+p to open the user preferences and then search for features -> terminal -> cwd and if it has a value you should clear it.

cwd is An explicit start path where the terminal will be launched, this is used as the current working directory (cwd) for the shell process. This may be particularly useful in workspace settings if the root directory is not a convenient cwd.

Perhaps vsCode does not have the right permissions? What happens if you run vsCode as administrator?

Can you change VScode terminal to git bash like in the picture ? Integrated terminals can be different. if it isnt visible @bieboebap answer can add the gitbash to your integrated terminal.

IMG

And for npm commands you should check this question.

update git to 2.37.3 currently https://git-scm.com/download/win
git add using fullPath is supposed to work

git --version
git version 2.37.3.windows.1

operating system: I assume windows because \\

Related