node.js - “submodule”似乎是一个 git 命令,但我们无法执行它

标签 node.js git visual-studio npm npm-install

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

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

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

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

最佳答案

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

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

关于node.js - “submodule”似乎是一个 git 命令,但我们无法执行它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54672008/

相关文章:

javascript - MongoDB 和 Nodejs,通过 ids 列表查找

git - 本地文件夹中的更改未反射(reflect)在 git、openstack 上

git - 是否有任何理由对从未更新的大文件使用 GIT-LFS

git - 应用使用 git log -p 创建的补丁

visual-studio - 为什么我被拒绝访问这些文件?

visual-studio-2010 - Visual Studio 属性表 : Why is Character Set missing?

javascript - Sequelize - 将新行添加到表并关联表

javascript - 表示没有设置Cookie

node.js - Node.JS 中带有自签名证书的 HTTPS 代理

visual-studio - SpecFlow 项目加载失败