You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running Windows 10 build 19041, npm version 6.14.4, and git version 2.27.0.windows.1.
When I run git submodule, it works as expected and exits without error. But when I create an npm script in my package.json like this:
"scripts": {
"sth": "git submodule"
}
And try to run it like npm run sth, it gives me this error:
> [email protected] sth D:\...\test-project
> git submodule
D:/Program_Files/Git/mingw64/libexec/git-core\git-submodule: line 22: .: git-sh-setup: file not found
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] sth: `git submodule`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] sth script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\.....
When
n/a
Where
n/a
How
When git is run from an npm script, it cannot add the git-core path to the PATH environment variable, and it fails to execute its bash scripts.
Current Behavior
When I run git submodule normally, this is prepended to the PATH:
/mingw64/libexec/git-core
But when I run it from within an npm script, this is instead prepended:
(I got this info by adding a line (echo "$PATH") to my git-submodule script in git's installation directory.)
Steps to Reproduce
Add a script like "sth": "git submodule" to your package.json and run it like npm run sth.
Expected Behavior
When I run git submodule from within an npm script, git-core path is also prepended in addition to npm-related paths. I expect my PATH environment variable to look like this:
The text was updated successfully, but these errors were encountered:
Shayan-To
changed the title
[BUG] git is unable to add 'git-core' to the PATH when run using npm scripts
[BUG] git is unable to add 'git-core' to the PATH when it is run using npm scripts
Jul 3, 2020
npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.
If your bug is preproducible on v7, please re-file this issue using our new issue template.
If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo
What / Why
I'm running Windows 10 build 19041, npm version 6.14.4, and git version 2.27.0.windows.1.
When I run
git submodule
, it works as expected and exits without error. But when I create an npm script in mypackage.json
like this:And try to run it like
npm run sth
, it gives me this error:When
Where
How
When
git
is run from annpm
script, it cannot add thegit-core
path to the PATH environment variable, and it fails to execute its bash scripts.Current Behavior
When I run
git submodule
normally, this is prepended to the PATH:/mingw64/libexec/git-core
But when I run it from within an npm script, this is instead prepended:
/d/Program_Files/nodejs/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/d/Shayan/MyDocuments/Coding/SampleProject/node_modules/.bin
(I got this info by adding a line (
echo "$PATH"
) to mygit-submodule
script in git's installation directory.)Steps to Reproduce
Add a script like
"sth": "git submodule"
to yourpackage.json
and run it likenpm run sth
.Expected Behavior
When I run
git submodule
from within an npm script,git-core
path is also prepended in addition to npm-related paths. I expect my PATH environment variable to look like this:/mingw64/libexec/git-core:/d/Program_Files/nodejs/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/d/Shayan/MyDocuments/Coding/SampleProject/node_modules/.bin
Who
References
The text was updated successfully, but these errors were encountered: