Offir
Offir

Reputation: 3491

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

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?

Upvotes: 2

Views: 1003

Answers (5)

Alex Silver
Alex Silver

Reputation: 386

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.

Upvotes: 2

Mr. Doge
Mr. Doge

Reputation: 886

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 \\

Upvotes: 0

Arty
Arty

Reputation: 898

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.

Upvotes: 0

bieboebap
bieboebap

Reputation: 300

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

Upvotes: 0

davidonet
davidonet

Reputation: 670

It might not answer your question but it should solve the issue.

You could use git bash as vscode terminal as describe here : https://blog.danielpadua.dev/posts/git-bash-with-vscode/

Upvotes: 0

Related Questions