“子模块”似乎是一个 git 命令,但我们无法执行它

Sab*_*ain 3 git visual-studio node.js npm npm-install

我克隆了一个 git 存储库,它是一个 Angular 7 和 .NET Core 应用程序,项目中一切正常,但是当我尝试恢复 npm 包时,出现以下错误。

\Microsoft\TeamFoundation\Team Explorer\Git\cmd\git.EXE submodule update - q --init --recursive fatal: 'submodule' 似乎是一个 git 命令,但我们无法执行它。也许 git-submodule 坏了?在 ChildProcess.exithandler (child_process.js:291:12) at ChildProcess.emit (events.js:182:13) at mayClose (internal/child_process.js:961:16) at Process.ChildProcess._handle.onexit (internal/ child_process.js:248:5) npm ERR!cb() 从未调用过!

#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"
  }
}
Run Code Online (Sandbox Code Playgroud)

我安装的node-version10.7.0npm-version6.4.1

我在 GitHub 上发现了一些类似的问题,他们在 npm-lifecycle 中添加了一个修复程序,所以我安装了,npm-lifecycle但我仍然遇到相同的错误。

LeG*_*GEC 5

submodule命令未内置到基本git.exe二进制文件中,它是作为名为 的 shell 脚本实现的git-submodule,它需要可从 访问%PATH%,并且对于运行该操作的用户来说是可执行的。

  • 你的%PATH%(或%PATH%你的 npm 进程)是什么?
  • 它是否包含 git 安装的路径,它似乎在\Microsoft\TeamFoundation\Team Explorer\Git\.
  • 运行 npm 进程的用户是否有执行权限git-submodule