簡體   English   中英

子模塊不是 git 命令(在 Windows 的 GIT 上使用 NPM)

[英]submodule is not a git command (with NPM on GIT for Windows)

嘗試使用 NPM 進行安裝時,出現錯誤:'submodule' is not a git command

適用於 Windows 的 Git bash(版本:2.20.1.windows.1)

$ npm install
Unhandled rejection Error: Command failed: C:\PROGRAM FILES\GIT\mingw64\bin\git.EXE submodule update -q --init --recursive
git: 'submodule' is not a git command. See 'git --help'.

at ChildProcess.exithandler (child_process.js:294:12)
at ChildProcess.emit (events.js:189:13)
at maybeClose (internal/child_process.js:970:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
npm ERR! cb() never called!

npm ERR! This is an error with npm itself.

我是 GIT 的初學者,我需要您的幫助才能找到解決方案?! 謝謝

使用簡化的 PATH和可移植的 Git(如PortableGit-2.20.1-64-bit.7z.exe )在任何你想要的地方解壓,再試一次。

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%
set PATH=c:\path\to\npm;%PATH%

然后使用您的npm install命令檢查該 CMD 會話(您在其中設置了所述簡化路徑)中是否仍然存在問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM