Chrome 扩展程序 - 包无效。详细信息:无法解压扩展程序

发布于 2024-12-13 11:09:00 字数 248 浏览 7 评论 0原文

我开发了一个 chrome 扩展并将其上传到 chrome 网上商店,一切都很顺利,我将它安装在我的 Mac 上,并在我的 chrome 中的 Ubuntu 机器上运行良好并安装。但是当我在 Windows 机器上尝试它时,下载后会弹出一条错误消息,提示“包无效,无法解压缩扩展”。

谁能告诉我这个操作系统特定问题的原因或可能的原因是什么。它与权限或相应文件夹名称或内容有什么关系吗?文件夹名称或扩展名没有任何特殊字符,以前的版本没问题。

提前致谢。

I worked on a chrome extension and uploaded it to chrome webstore and everything went well, I installed it on my Mac and on my Ubuntu machines in chrome it worked fine and installed. But when I try it on Windows machines, after download it popups a error message saying "Invalid Package, Can't unzip the extension".

Can any one tell me why or what might be the cause for this OS specific issue. Does it have anything to do with the permission or anything with respective folder name or content? The folder name or the extension name don't have any special characters and the previous version was fine.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

少女净妖师 2024-12-20 11:09:00

导致此问题的另一个原因(错误:无法解压缩扩展)可能是您在 zip 中包含根目录。
您应该将所有文件压缩到同一级别的manifest.json 中。

示例

-yourappfolder
   |_manifest.js
   |_popup.html

在这种情况下,您应该仅压缩 manifest.jspopup.html,而不是压缩整个目录 yourappfolder

换句话说,在您的 zip 文件中,您不应该看到 yourappfolder 目录。

Another cause of this problem (Error: could not unzip extension) might be that you include the root directory in your zip.
You should zip all files in the same level of manifest.json.

Example

-yourappfolder
   |_manifest.js
   |_popup.html

In this case you should zip only manifest.js and popup.html, instead of zip the entire directory yourappfolder.

In other words, in your zip file you should NOT see the yourappfolder directory.

孤独患者 2024-12-20 11:09:00

这是因为包内有一个文件名称中包含 Windows 无效字符或文件已损坏。就我而言,我尝试下载 CouponsHelper 扩展,也显示了此错误。

我手动下载了CRX文件并使用7Zip打开它。文件夹中有一个名为 Icon.txt 的文件。当我尝试使用 7Zip 解压时,也会出现错误。

请注意,屏幕截图上的 Icon 文件中有一个无效字符,并且它的大小为零(可能已损坏)。

7Zip 的屏幕截图

This is because there a file inside the package with a Windows invalid character in name or there a corrupted file. In my case I've tried to download the CouponsHelper extension and this error was displayed too.

I downloaded the CRX file manually and opened it with 7Zip. In the folder had a file named Icon. When I try to extract using 7Zip an error occurs too.

Note on the screenshot that there an invalid char in Icon file and that it is zero sized (possibly corrupted).

Screenshot of 7Zip

故笙诉离歌 2024-12-20 11:09:00

因此,它的技巧是压缩文件夹中的所有文件而不是文件夹本身。

注意:如果它保存在 Google Drive(本地同步)中,这也会弄乱它。 Drive 会将小图标附加到显示为未知的文件夹。

因此,请在 Google 云端硬盘之外重新创建该文件夹。
这就是“仅压缩文件夹内部”修复后困扰我的问题。

So the trick it to compress all the files within the folder not the folder itself.

NOTE: If it's saved in Google Drive (local syncing) this well mess it up too. Drive attaches little icons to folders that show up as unknown.

So remake the folder outside of Google Drive.
That's what was messing mine up after the "only compress inside of folder" fix.

情徒 2024-12-20 11:09:00

我遇到了同样的问题,但原因不同。

我发现有一张图片的名称太长。当我用更短的名称替换名称并构建新包时,它安装成功。

我希望这可以帮助任何可能面临同样问题的人。

I had the same problem but the reason was different.

I found that there is an image which has a name that is too long. When I replaced the name with a shorter one and built new package, it installed successfully.

I hope this helps anyone may facing the same problem.

牵你手 2024-12-20 11:09:00

快速的 Google 只出现了 一个可能有用的结果,但我不确定它是否有帮助。

该错误消息是否与您所看到的完全一样(即逐字逐句)?我在代码中找不到它。

我可能错了,但我认为这个可能是导致错误的代码。不幸的是,zip::Unzip 调用可能会因多种原因而失败,并且仅在日志中提供更多详细信息。我猜这样的日志输出到这个位置(Windows XP);

%USERPROFILE%\Local Settings\Application Data\Google\Chrome\Application\debug.log

这些信息可能对您没有用,但我想我应该向您展示我的调查:)

您是否尝试再次安装扩展并且您是否具有管理权限(不确定这是否会产生影响)?

A quick Google only turned up one possibly useful result but I wasn't sure if it would help.

Is that error message exactly what you see (i.e. word for word)? I couldn't find it in the code.

I may be wrong but I think this could be the code responsible for the error. Unfortunately, the zip::Unzip call can potentially fail for a number of reasons and only provides more details in the logs. I'm guessing such logs output to this location (Windows XP);

%USERPROFILE%\Local Settings\Application Data\Google\Chrome\Application\debug.log

None of this information may be useful to you but I thought I'd show you my investigation :)

Have you tried to install the extension again and do you have administration rights (not sure if this would have an affect here)?

胡大本事 2024-12-20 11:09:00

我遇到了同样的问题,但它拒绝了它,因为文件太大或路径太长(Windows ...),这是因为我不小心将整个 node_modules 目录包含在 <代码>.crx文件。

I had the same problem but it was rejecting it because either the file was too big or the paths were too long (Windows...), which was because I accidentally included my entire node_modules directory in the .crx file.

眼睛会笑 2024-12-20 11:09:00

这可能是由很多事情引起的。
对我来说,问题在于包内有 .xcf (Gimp) 文件。

该扩展程序在手动解压缩时加载正常,但在从 Chrome 网上应用店加载时显示“无法解压缩”错误。

It could be caused by a lot of things.
For me, the problem was having .xcf (Gimp) files inside the package.

The extension loaded fine when unzipped manually but showed the "couldn't unzip" error in when loaded from the Chrome Webstore.

两仪 2024-12-20 11:09:00

我在使用 MacOS 进行压缩时遇到了问题。 zip 中有一堆隐藏文件。

使用 Windows 解决了这个问题,但可能不使用 MacOS 中的默认拉链也能起到同样的作用。

I had problems with zipping with MacOS. There was a bunch of hidden files in the zip.

Using Windows solved it but probably taking not the default zipper in MacOS should do the same.

随遇而安 2024-12-20 11:09:00

我有类似的问题。
我的解决方案是:

  1. 将 CRX 解压缩到一个目录...假设名为 freddy123

  2. 将“_manifest”重命名为“manifest”..即删除下划线。

  3. Chrome->设置->更多工具->扩展(选中开发模式复选框)
  4. 加载解压的扩展(选择freddy123目录)

这对我有用。

I had a similar problem.
My solution was:

  1. unzip the CRX to a directory...lets say called freddy123

  2. Rename "_manifest" to "manifest"..i.e remove the underscore.

  3. Chrome->settings->More Tools->Extensions (Check Develop Mode Check box)
  4. Load Unpacked extension (select freddy123 directory)

This worked for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文