the add on could not be installed because it appears to be corrupt

Dareman picture Dareman · Feb 13, 2015 · Viewed 7.7k times · Source

After converting folder into .xpi file and drag and drop into firefox I'm receiving the error message as " the add on could not be installed because it appears to be corrupt " in firefox browser.

I tried to compressed the the folder using winzip,7z, winrar and rename it into .xpi file. However I still get the same error after performing the same operation.

How to make the firefox accept our own plugin in local?

Kindly Help me

Answer

nmaier picture nmaier · Feb 14, 2015

Putting my Psychic-Debugging hat on, here is the most likely cause of your problem:

Your XPI has the wrong internal structure. While files should be located directly within the zip root directory, your XPI (zip) actually contains an intermediary folder name. Most zip tools will do that when you compress the folder, instead of selecting the actual files within the folder and compressing that.

When you open the XPI in a compression tool, or list the contents like @the8472 suggested via unzip -v addon.xpi, a correctly packaged XPI would look like this (the order does not matter)

install.rdf
icon.png
chrome.manifest
chrome/content/overlay.xul
...

But as noted, and as most likely the case here, when selecting the folder and compressing that, the XPI will be packaged incorrectly and look something like this, which is wrong:

myaddon/install.rdf
myaddon/icon.png
myaddon/chrome.manifest
myaddon/chrome/content/overlay.xul
...