【发布时间】:2020-07-21 21:04:59
【问题描述】:
我已更新我的项目以使用 angular 工作区,并希望使用 angular-gh-pages 部署我的演示应用程序。回购是https://github.com/Gillardo/ngx-bootstrap-datetime-popup
我在 package.json 中创建了一个名为 gh-pages 的命令,它执行命令 ng deploy demo --no-silent,但是当我运行它时,我在控制台中收到此错误。好像项目已经构建成功了,但是上传到git失败了?
我在 Windows 10 机器上运行它。
有人可以帮忙吗?
???????? Uploading via git, please wait...
Cloning https://github.com/Gillardo/ngx-bootstrap-datetime-popup/ into node_modules\gh-pages\.cache\github.com!Gillardo!ngx-bootstrap-datetime-popup
Cleaning
Fetching origin
Checking out origin/gh-pages
❌ An error occurred when trying to deploy:
git-upload-pack '.': git-upload-pack: command not found
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
除了我在 Windows 命令行中运行 SET GIT_TRACE=1 的 cmets,然后再次运行代码,这就是我得到的
我已经这样做了,在删除我的整个存储库之后,运行npm install 来安装我的node_modules,然后运行我已经设置为命令的npm run gh-pages,并运行它,就像在我的package.json 中一样"gh-pages": "ng deploy demo --no-silent"
不确定这是否有任何区别,但在我的 angular.json 文件中,我已经设置了这个
编辑: 这是失败时图片中的文字
�� Uploading via git, please wait...
Cloning https://github.com/Gillardo/ngx-bootstrap-datetime-popup.git into node_modules\gh-pages\.cache\github.com!Gillardo!ngx-bootstrap-datetime-popup.git
❌ An error occurred when trying to deploy:
Remote url mismatch. Got "12:21:47.470038 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin" but expected "https://github.com/Gillardo/ngx-bootstrap-datetime-popup.git" in node_modules\gh-pages\.
cache\github.com!Gillardo!ngx-bootstrap-datetime-popup.git. Try running the `gh-pages-clean` script first.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ngx-bootstrap-datetime-popup@5.1.0 gh-pages: `ng deploy demo --no-silent`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ngx-bootstrap-datetime-popup@5.1.0 gh-pages 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:\Users\Darren\AppData\Roaming\npm-cache\_logs\2020-05-03T11_21_47_564Z-debug.log
这就是那个日志包里有用的东西
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Darren\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'gh-pages' ]
2 info using npm@6.4.0
3 info using node@v10.15.3
4 verbose run-script [ 'pregh-pages', 'gh-pages', 'postgh-pages' ]
5 info lifecycle ngx-bootstrap-datetime-popup@5.1.0~pregh-pages: ngx-bootstrap-datetime-popup@5.1.0
6 info lifecycle ngx-bootstrap-datetime-popup@5.1.0~gh-pages: ngx-bootstrap-datetime-popup@5.1.0
7 verbose lifecycle ngx-bootstrap-datetime-popup@5.1.0~gh-pages: unsafe-perm in lifecycle true
8 verbose lifecycle ngx-bootstrap-datetime-popup@5.1.0~gh-pages: PATH: C:\Users\Darren\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\Github\ngx-bootstrap-datetime-popup\node_modules\.bin;D:\Github\ngx-bootstrap-datetime-popup\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\WINDOWS\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\nodejs\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\dotnet\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Users\Darren\AppData\Local\Microsoft\WindowsApps;C:\Users\Darren\AppData\Local\GitHubDesktop\bin;C:\Users\Darren\.dotnet\tools;C:\Users\Darren\AppData\Local\Microsoft\WindowsApps;;C:\Users\Darren\AppData\Local\Programs\Fiddler;C:\Users\Darren\AppData\Roaming\npm;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\
9 verbose lifecycle ngx-bootstrap-datetime-popup@5.1.0~gh-pages: CWD: D:\Github\ngx-bootstrap-datetime-popup
10 silly lifecycle ngx-bootstrap-datetime-popup@5.1.0~gh-pages: Args: [ '/d /s /c', 'ng deploy demo --no-silent' ]
11 silly lifecycle ngx-bootstrap-datetime-popup@5.1.0~gh-pages: Returned: code: 1 signal: null
12 info lifecycle ngx-bootstrap-datetime-popup@5.1.0~gh-pages: Failed to exec gh-pages script
13 verbose stack Error: ngx-bootstrap-datetime-popup@5.1.0 gh-pages: `ng deploy demo --no-silent`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Darren\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
13 verbose stack at EventEmitter.emit (events.js:189:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Darren\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:189:13)
13 verbose stack at maybeClose (internal/child_process.js:970:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid ngx-bootstrap-datetime-popup@5.1.0
15 verbose cwd D:\Github\ngx-bootstrap-datetime-popup
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Darren\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "gh-pages"
18 verbose node v10.15.3
19 verbose npm v6.4.0
20 error code ELIFECYCLE
21 error errno 1
22 error ngx-bootstrap-datetime-popup@5.1.0 gh-pages: `ng deploy demo --no-silent`
22 error Exit status 1
23 error Failed at the ngx-bootstrap-datetime-popup@5.1.0 gh-pages script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
如果我在运行命令之前运行 `SET "GIT_TRACE=" 我会得到这个
Checking out origin/gh-pages
❌ An error occurred when trying to deploy:
error: cannot spawn sh: No such file or directory
fatal: unable to fork
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ngx-bootstrap-datetime-popup@5.1.0 gh-pages: `ng deploy demo --no-silent`
npm ERR! Exit status 1
日志这样说
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Darren\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'gh-pages' ]
2 info using npm@6.4.0
3 info using node@v10.15.3
4 verbose run-script [ 'pregh-pages', 'gh-pages', 'postgh-pages' ]
5 info lifecycle ngx-bootstrap-datetime-popup@5.1.0~pregh-pages: ngx-bootstrap-datetime-popup@5.1.0
6 info lifecycle ngx-bootstrap-datetime-popup@5.1.0~gh-pages: ngx-bootstrap-datetime-popup@5.1.0
7 verbose lifecycle ngx-bootstrap-datetime-popup@5.1.0~gh-pages: unsafe-perm in lifecycle true
8 verbose lifecycle ngx-bootstrap-datetime-popup@5.1.0~gh-pages: PATH: C:\Users\Darren\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\Github\ngx-bootstrap-datetime-popup\node_modules\.bin;D:\Github\ngx-bootstrap-datetime-popup\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\WINDOWS\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\nodejs\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\dotnet\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Users\Darren\AppData\Local\Microsoft\WindowsApps;C:\Users\Darren\AppData\Local\GitHubDesktop\bin;C:\Users\Darren\.dotnet\tools;C:\Users\Darren\AppData\Local\Microsoft\WindowsApps;;C:\Users\Darren\AppData\Local\Programs\Fiddler;C:\Users\Darren\AppData\Roaming\npm;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\
9 verbose lifecycle ngx-bootstrap-datetime-popup@5.1.0~gh-pages: CWD: D:\Github\ngx-bootstrap-datetime-popup
10 silly lifecycle ngx-bootstrap-datetime-popup@5.1.0~gh-pages: Args: [ '/d /s /c', 'ng deploy demo --no-silent' ]
11 silly lifecycle ngx-bootstrap-datetime-popup@5.1.0~gh-pages: Returned: code: 1 signal: null
12 info lifecycle ngx-bootstrap-datetime-popup@5.1.0~gh-pages: Failed to exec gh-pages script
13 verbose stack Error: ngx-bootstrap-datetime-popup@5.1.0 gh-pages: `ng deploy demo --no-silent`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Darren\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
13 verbose stack at EventEmitter.emit (events.js:189:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Darren\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:189:13)
13 verbose stack at maybeClose (internal/child_process.js:970:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid ngx-bootstrap-datetime-popup@5.1.0
15 verbose cwd D:\Github\ngx-bootstrap-datetime-popup
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Darren\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "gh-pages"
18 verbose node v10.15.3
19 verbose npm v6.4.0
20 error code ELIFECYCLE
21 error errno 1
22 error ngx-bootstrap-datetime-popup@5.1.0 gh-pages: `ng deploy demo --no-silent`
22 error Exit status 1
23 error Failed at the ngx-bootstrap-datetime-popup@5.1.0 gh-pages script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
【问题讨论】:
-
你用的是什么外壳?你能检查
git-upload-pack是否作为你shell的命令存在吗?例如尝试拨打git-upload-pack --help -
为了进一步调试,如果您使用的是 Windows cmd,请运行
set GIT_TRACE=1;如果您使用的是 git-bash,请运行export GIT_TRACE=1,然后运行您的 git 命令并使用相同的输出更新问题 -
感谢您的建议,我已根据您的要求更新了我的帖子。
-
所以您不再收到此错误:
git-upload-pack '.': git-upload-pack: command not found? -
抱歉,现在出现与上述不同的错误
标签: angular git npm angular-cli