Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'submodule' appears to be a git command, but we were not able to execute it

I have cloned a git repository it's an Angular 7 & .NET Core app, everything is fine in the project but when I try to restore npm packages I get the following error.

\Microsoft\TeamFoundation\Team Explorer\Git\cmd\git.EXE submodule update - q --init --recursive fatal: 'submodule' appears to be a git command, but we were not able to execute it. Maybe git-submodule is broken? at ChildProcess.exithandler (child_process.js:291:12) at ChildProcess.emit (events.js:182:13) at maybeClose (internal/child_process.js:961:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5) npm ERR! cb() never called!

#Package.json

{
 "name": "name",
 "version": "6.1.1",
 "license": "......",
 "scripts": {
   "ng": "ng",
   "start": "ng serve --open",
   "start-hmr": "ng serve --configuration hmr -sm=false",
   "start-hmr-sourcemaps": "ng serve --hmr -e=hmr",
   "build": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev",
   "build-stats": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev --stats-json",
   "build-prod": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --prod",
   "build-prod-stats": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --prod --stats-json",
   "test": "ng test",
   "lint": "ng lint",
   "e2e": "ng e2e",
   "bundle-report": "webpack-bundle-analyzer dist/stats.json"
},
"private": true,
"dependencies": {
  "@agm/core": "1.0.0-beta.3",
  "@angular/animations": "6.0.5",
  "@angular/cdk": "6.2.1",
  "@angular/common": "6.0.5",
  "@angular/compiler": "6.0.5",
  "@angular/core": "6.0.5" 
},
"devDependencies": {
  "@angular-devkit/build-angular": "0.6.8",
  "@angular/cli": "6.0.8",
  "@angular/compiler-cli": "6.0.5",
  "@angular/language-service": "6.0.5",
  "@angularclass/hmr": "2.1.3",  
  "typescript": "2.7.2",
  "webpack-bundle-analyzer": "2.13.1"
  }
}

My installed node-version is 10.7.0 and npm-version is 6.4.1

I found on GitHub some issues like this and they added a fix in npm-lifecycle, so I installed the npm-lifecycle but I'm still getting the same error.

like image 652
Sabir Hossain Avatar asked Mar 05 '23 12:03

Sabir Hossain


1 Answers

The submodule command is not built into the base git.exe binary, it is implemented as a shell script named git-submodule, which needs to be accessible from the %PATH%, and to be executable for the user who runs the action.

  • What is your %PATH% (or the %PATH% for your npm process) ?
  • Does it include the path to your git installation, which seems to be somewhere in \Microsoft\TeamFoundation\Team Explorer\Git\ ?
  • Does the user which runs the npm process have execution rights on git-submodule ?
like image 135
LeGEC Avatar answered Mar 07 '23 02:03

LeGEC