Visual Studio Code离线安装扩展失败 Corrupt ZIP: end of central directory record signature not found

Extensions for the Visual Studio family of products

$ wget -nv https://marketplace.visualstudio.com/_apis/public/gallery/publishers/llvm-vs-code-extensions/vsextensions/vscode-clangd/latest/vspackage

$ du -sk vspackage
1244    vspackage

$ md5sum vspackage
10f6bdb1151a954a702f8a6db6f3bd52  vspackage

cmd> certutil.exe -hashfile .\vspackage MD5
MD5 hash of .\vspackage:
74f82f716616796157bde8008c8e5a45

$mv vspackage vspackage.vsix

$ code --install-extension vspackage.vsix
Installing extensions on SSH: boozy-olive-harrier...
Corrupt ZIP: end of central directory record signature not found
Failed Installing Extensions: vscode-remote://ssh-remote%2Bboozy-olive-harrier/root/vspackage.vsix

解决办法

$ wget -nv https://marketplace.visualstudio.com/_apis/public/gallery/publishers/llvm-vs-code-extensions/vsextensions/vscode-clangd/latest/vspackage
2021-02-11 09:04:22 URL:https://marketplace.visualstudio.com/_apis/public/gallery/publishers/llvm-vs-code-extensions/vsextensions/vscode-clangd/latest/vspackage [1270960/1270960] -> "vspackage"

$ file vspackage
vspackage: gzip compressed data, max speed, from FAT filesystem (MS-DOS, OS/2, NT), original size modulo 2^32 1416661

$ mv vspackage vspackage.gz
$ gunzip -v vspackage.gz
vspackage.gz:    10.3% -- replaced with vspackage

$ file vspackage
vspackage: Zip archive data, at least v2.0 to extract
$ mv vspackage vscode-clangd.vsix
# 这个vscode-clangd.vsix就可以被VS Code成功安装了。

Reference

VSCode Marketplace extension: Corrupt ZIP: end of central directory record signature not found

posted @ 2022-04-13 16:35  素丶素  阅读(2924)  评论(0编辑  收藏  举报