谷歌浏览器扩展
我有两个文件。 manifest.json 和 content.js。我已将这两个文件压缩为 Zip 格式并转换为 CRX 格式。
然后只需将 .crx 文件拖放到 Google Chrome 浏览器中并继续安装 crx 文件即可。但它显示一条警报消息为“CRX_MAGIC_NUMBER_INVALID”。
我该如何解决这个问题?
I have two files. manifest.json and content.js. I have compressed the both files in Zip format and conver into CRX format.
Then just drag and drop the .crx file in Google chrome browser and continue to install the crx file. But it shows a alert message as "CRX_MAGIC_NUMBER_INVALID".
How to i resolve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我的朋友在安装自制扩展程序时也遇到了同样的问题。这应该是您问题的解决方案。
My friend had the same problem with installing a homebrew extension too. This should be the solution to your issue.
Chrome 中有一个打包扩展选项。转到管理扩展,您将看到该选项。他们将为您制作
.crx
文件。Well there is a pack extension option in Chrome. Go to manage extension and there you will see that option. They will make the
.crx
file for you.否则你可以使用批处理文件来做到这一点
Else you can do that using a batch file
这是您的 CRX 文件格式的问题。代码
http://src.chromium.org/svn /trunk/src/chrome/browser/extensions/sandboxed_extension_unpacker.cc
在开头查找“幻数”文件,详细信息请参见此处
http://code.google.com/chrome/extensions/crx。 html
看来(总是)不可能压缩您的扩展并将其重命名为 crx。也许与使用的 zip 工具有关?无论如何,该线程讨论了一个非常相似的问题和解决方案。
http://groups.google.com/a /chromium.org/group/chromium-apps/browse_thread/thread/1785b46c2998af2c
It's a problem with the format of your CRX file. The code
http://src.chromium.org/svn/trunk/src/chrome/browser/extensions/sandboxed_extension_unpacker.cc
looks for a "magic number" at the start of the file, as detailed here
http://code.google.com/chrome/extensions/crx.html
It appears that it isn't (always) possible to zip your extension and rename it to crx. Perhaps something to do with the zip tool used? Anyway this thread discusses a very similar problem and solutions.
http://groups.google.com/a/chromium.org/group/chromium-apps/browse_thread/thread/1785b46c2998af2c