Chrome Extension - Invalid Package. Details:Can't unzip the extension - google-chrome

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.

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).

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.

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.

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.

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)?

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.

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.

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.

I had a similar problem.
My solution was:
unzip the CRX to a directory...lets say called freddy123
Rename "_manifest" to "manifest"..i.e remove the underscore.
Chrome->settings->More Tools->Extensions (Check Develop Mode Check box)
Load Unpacked extension (select freddy123 directory)
This worked for me.

Related

Chrome's map to file system resource not working after update

I can add a folder to the workspace (which doesn't seem to do anything, as far as I can tell), but the "map to file system resource" option seems to have been removed, and I can no longer live-edit css files.
Is this a bug, or has the process for mapping css files been changed?
This talk (https://developers.google.com/web/updates/2017/10/devtools-release-notes) says that the new version uses "magic" to map remote files to local ones, but I can't seem to get it to work at all.
For reference, I'm trying to map a reddit css file to one on my own computer. It worked fine on a previous version of Chrome (basically I add the folder, and map the css file inside it, which has been renamed to have the same name as the remote one) but not on the new one (Chrome 63)
I've just fiddled around with a problem, where only some files got mapped to my local workspace.
Turned out that Google Chrome also checks and compares the last modified date of your files.
If the file on the server has a more recent date than your local copy, this file won't be mapped.
I deleted the Bootstrap file on the server side and uploaded my local copy, which has an older last modified date. Google Chrome instantly mapped the file to my local workspace.
Out of curiosity I ran touch bootstrap.min.js on my server to set the last modified date to today. This broke my file mapping again.
Chrome removed manually mapping to filesystem resources because of the new Workspaces 2.0 (See: https://developers.google.com/web/updates/2017/10/devtools-release-notes).
You should be able to drag and drop your folder into the sources tab and it'll link the files automagically.
However automatic mapping doesn't work in many situations and there is a Chrome bug to re-add manual mapping
I had the same problem so I downgraded to Chrome 62 (preferences, history, extensions and so on are preserved).
Download Chrome 62 from
https://www.slimjet.com/chrome/google-chrome-old-version.php .
On OS X trash /Applications/Google Chrome.
Switch off auto-update by setting "defaults write com.google.Keystone.Agent alwaysPromptForUpdates 1". Default is 0.
May be you have to set "defaults write com.google.Keystone.Agent checkInterval 0" too. Default is 18000.
Install Chrome 62 as usual.
After starting Chrome 62 open "About Google Chrome". Chrome is checking for updates, but will prompt you to confirm.
The "Map to File System Resource..." menu item is missing. There appears to be no way to map files. It is completely broken as far as I can tell.
For me, the problem turned out to be the presence of the copyright symbol © in the file headers (which affected just about every file). With this character in the files, devtool refused to map the files but with it removed, the files map fine.
I'm also using Chrome 63.0.3239.132 (Official Build) (64-bit) and as I wanted to use the DevTools Live-edit to edit some js files I saw that the option "Map to file system resource" is missing.
After some research I have found out that the Live-edit is perfectly working in Version 63, you just have to:
go to Sources and then FileSystem
add the folder with your code to the workspace
After that, a small little green point will be displayed near your files (it means the synchronization is ready) and the changes via DevTools can be persisted locally:
Thanks to others in this thread saying chrome is checking the modified date.
Adding this to .htaccess solved it for me
IndexOptions SuppressLastModified
Of course you would not want this to get into your production code as it could stop browser caching working.
I cleared the cache and it works now.
Previously, I opened my CSS file from my FTP client, then I dragged the containing folder into the Sources tab > Filesystem tab (without caring about any folder names nor structure, I just dragged the FTP clients containing folder into it).
The persistent mapping worked straight away, edits from the Chrome Dev Tools were saving on the server. After 30 minutes of fiddling and playing around, it just stopped working and the CSS resource got greyed out. The file icon with the green dot was not appearing anymore.
It didn't matter what I'd do, it would not work, but when I cleared my cache, it started to work again.
File mapping started working reliably for me once I turned on a devtools setting -- click the upper-right gear icon and check Preferences > Network > "Disable cache (while DevTools is open)"
As of today, with Chrome Version 63.0.3239.108 (Official Build) (64-bit):
The feature appears to be still broken, not working 'automagically' nor consistently with the previous behavior.
However, adding a folder that reflects the resource's URL as seen in the Network tab, make it work again. So if for instance, in the Network Navigator tab you have:
http://mylocal.site/wp-content/themes/mytheme/assets/sass/partials/_header.scss
You will just need to add the whole wp-content/ folder to the Filesystem tab to get the feature work again as expected.
Had the same problem, but when my source maps included sourcesContent, the file mappings were automatically made and I could live edit my scss. Apparently chrome uses the content to find the right file.
node-sass --source-map-contents

How does Windows link HTML files to folders?

Almost every time you save a web page from a web browser to your local computer a PAGENAME.html (or .htm) file is created and a folder named 'PAGENAME_files' that contains resources specific to that page.
If you copy/move/delete either the folder or the .html file Windows automatically does the same operation the other file as well.
This behaviour also happens if you create a file named 1.html and a folder called 1_files.
How does this link happen? And why does it work only with web files?
This is a shell feature, not a file system feature. The shell copy engine just looks for a folder with the same name (plus a localized suffix) when copying/moving .htm[l] files.
This feature is called Connected Files and is documented here.
It's a built-in linkage in Windows.
Open up Explorer (not IE, Windows), Tools, Options, View, then in Advanced Settings there'll be a "Managing pairs of Web pages and folders" section.
If people are stuck and ended up here to find how to unlink, here's an easy trick : on Windows 10, I couldn't find how to unlink a .html file from its associated media folder, so I deleted both of them, and in the bin I restored only the .html file and it was then restored and unlinked from its folder.
It is a good question.
Under Windows 7 I managed to solve forced links by simply renaming the file.
I think it is the easiest way.

Google Chrome Extension Crashes When Installed From Webstore - Need To Identify Cause of Crash

I have a google chrome extension that crashes after you install it from the webstore. When installed from a local copy the extension does not crash. The crash happens when you click the tool bar icon that is added once it has been installed. The icon is supposed to load a table with URLs. Once restarted all you get is the option to recover tabs. I was hoping someone could help identify the issue of the crash or tell me how to access a crash report to see what is causing the problem.
The extension is located here:
Chrome Store App
Any help or direction will be very appreciated. Thank you
I've looked into your issue, and there are two issues here:
Your extension gets disabled, "This extension may have been corrupted."
Chrome crashes.
The latter is caused by a bug that has been fixed in Chrome 40, so I'll only focus on the first issue.
The first issue is caused by Content Verification, an (experimental) security feature in Chrome that ensures the integrity of extensions from the Chrome web store, by disabling extensions that have become corrupted crbug.com/369895. Corruption is detected by verifying the checksum of a file whenever an extension file is accessed by Chrome (for files referenced in the manifest file: at install-time; for other (embedded) files: when the file is loaded).
Unfortunately, there are some bugs in the implementation that causes extensions to be disabled in the following circumstances as well:
crbug.com/439464 - The spelling of a filename in does not match the spelling of the path. On Windows and some Mac systems, the filesystem is case-sensitive, so during development, you may not notice that the spelling of the filename is incorrect. Content verification is case-sensitive, so it will treat "icon.png" different from (uppercase) "Icon.png".
(This discrepancy in checks is unfortunate, but a good thing: if you use an incorrect spelling in the icons field, then the extension would not load on case-sensitive filesystems such as those commonly used on Linux.)
crbug.com/444085 - The paths are not resolved into a canonical form. When you use two "//" instead of "/", then Chrome will find the file, but not its corresponding checksum and disable the extension. To fix this, change "path//to/file" to "path/to/file". Fixing static paths (e.g. in HTML and CSS files) is relatively easy, but if you construct the paths dynamically, then finding the culprit becomes much harder.
To find out why your extension gets disabled, follow the instructions at crbug.com/444085#c25.
The problem was related to a broken url in one of the css files. By disabling all scripts and css we were able to find the problem.

chm viewer unable to show contents

I have a chm file that I can open at home. I use windows XP at home and at work. However, when I open the file at work it doesn't show the contents of the file. It properly shows the TOC for the file though. Any ideas pls?
Try to right-click on your chm file and select properties. You will see an "Unblock" button. Click on it, it should solve your problem.
Other than what Nicolas suggested, you may not be able to see contents of a CHM that you open over a UNC path. If that is the case copy the file to a local drive.
just go to power shell and run it as administrator,
cd your folder
and use the following command
Unblock-File '.\filename.chm'
On Windows 7 copying the file locally and unchecking the file opening warning message worked.
I had the same situation, on a Windows 10 (VMware) system. I had to move the file to a local drive as suggested by another poster AND THEN uncheck the file opening warning message. Opening the file gave a "Open File - Security Warning" message, with a checkbox at the bottom "Always ask before opening this file". Until I unchecked that box, only the TOC showed. After unchecking, the contents showed properly. HTH someone else!
Open command prompt and run as administrator.
Go to file location, input the file name and press enter.
It should open the file and view contents in chm viewer.
More read at: http://langbasics.blogspot.in/2014/12/chm-viewer-unable-to-show-contents.html
Thanks
It appears a lot of people have this problem but were unable to track down a solution. There are apparently different levels of authentication. Most articles I read tell you to set the MaxAllowedZone to '1' which means that local machine zone and intranet zone are allowed but '4' allows access for 'all' zones.
For more info, read this article:
https://support.microsoft.com/en-us/kb/892675
This is how my registry looks (I wasn't sure it would work with the wild cards but it seems to work for me):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
"MaxAllowedZone"=dword:00000004
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
"UrlAllowList"="\\\\<network_path_root>;\\\\<network_path_root>\*;\\ies-inc.local;http://www.*;http://*;https://www.*;https://*;"
As an additional note, weirdly the "UrlAllowList" key was required to make this work on another PC but not my test one. It's probably not required at all but when I added it, it fixed the problem. The user may have not closed the original file or something like that. So just a consideration. I suggest try the least and test it, then add if needed. Once you confirm, you can deploy if needed. If the 'Unblock' method does not work, or you do not see the option, this should. Good Luck!
P.S. Another method that worked was mapping the path to the network locally by using mklink /d (symbolic linking in Windows 7 or newer) but mapping a network drive letter (Z: for testing) did not work. Just food for thought and I did not have to 'Unblock' any files. Also the accepted 'Solution' did not resolve the issue for me.
Your CHM File Has the "#" Hash Character in the Filename or in the Directory Name. Please remove "#" and you will be able to see the content. If still you are not able to see then please visit following link: https://www.helpsmith.com/chm-cannot-be-displayed.php
Windows block *.chm files came from another computer fore security reason. Click right mouse button on file and set unblock checkbox see.
If someone need, there is a web page: http://topdf.com/ where is possible convert a chm in to pdf. I tested it with a chm of ~18MB and 615 pages. I was able to got a pdf with a hyperlinked contents table.
I was experiencing the same problem.
I read that the .chm file only worked on NTFS.
My file was on a cloud network drive which is not NTFS, so I copied it locally and the problem was gone.
Use SumatraPDF. It opens .chm files.
I had same problem and zipped the file then open it from inside the zip program.(I use 7-zip)

How do I directly modify a Google Chrome Extension File? (.CRX)

I'm not sure in which languages those extensions are, I think the are written in Html, Javascript or JSON. As far as I know they are "compressed" in a .CRX file.
It is possible to directly modify the html, js, json of a Chrome Extension (or whatever language they use)?
Installed Chrome extension directories are listed below:
Copy the folder of the extension you wish to modify. ( Named according to the extension ID, to find the ID of the extension, go to chrome://extensions/). Once copied, you have to remove the _metadata folder.
From chrome://extensions in Developer mode select Load unpacked extension... and select your copied extension folder, if it contains a subfolder this is named by the version, select this version folder where there is a manifest file, this file is necessary for Chrome.
Make your changes, then select reload and refresh the page for your extension to see your changes.
Chrome extension directories
Mac:
/Users/username/Library/Application Support/Google/Chrome/Default/Extensions
Windows 7:
C:\Users\username\AppData\Local\Google\Chrome\User Data\Default\Extensions
Windows XP:
C:\Documents and Settings\YourUserName\Local Settings\Application Data\Google\Chrome\User Data\Default
Ubuntu 14.04:
~/.config/google-chrome/Default/Extensions/
I searched it in Google and I found this:
The Google Chrome Extension file type is CRX. It is essentially a compression format. So if you want to see what is behind an extension, the scripts and the code, just change the file-type from “CRX” to “ZIP” .
Unzip the file and you will get all the info you need. This way you can see the guts, learn how to write an extension yourself, or modify it for your own needs.
Then you can pack it back up with Chrome’s internal tools which automatically create the file back into CRX. Installing it just requires a click.
A signed CRX file has a header that will cause most/all unzippers to barf. This is not the easiest way to go about it, but here's how to do it from a bash command line.
The basic idea is to find where the original unsigned zipfile begins, then copy the CRX file to a zip file but exclude the CRX header.
hexdump -C the_extension.crx | more
Look in the output for the start of the zip file, which are the ASCII bytes "PK". In the sample I tried, the PK was at offset 0x132. (From reading the CRX spec, I think this number will vary from file to file because of different signature lengths.) That number is what we'll use in the next step.
dd if=the_extension.crx of=the_extension.zip bs=1 skip=0x132 (For the skip parameter, substitute the offset you found in the previous step.)
Now unzip the .zip that you just created.
Fiddle with the files in the unzipped directory, then either install the unsigned/unpacked extension into your Chrome installation, or else repackage it just as you would any other Chrome extension.
I'm sure that there is a more concise way to do this. Bash experts, please improve on my answer.
Note that some zip programs have trouble unzipping a CRX like sathish described - if this is the case, try using 7-Zip - http://www.7-zip.org/
I have read the other answers and found it important to note a few other things:
1.) For Mac users: When you click "Load unpacked extension...", the Library folder is by default hidden and (even if the Show Hidden files option is toggled on your Mac) it might not show up in Chrome's finder window.
2.) The sub folder containing the extension is a random alpha-numeric string named after the extension's ID, which can be found on Chrome's extension page if Developer flag is set to true. (Upper right hand checkbox on the extensions page)
(Already said) I found this out while making some Chrome themes (which are long gone now... :-P)
Chrome themes, extensions, etc. are just compressed files. Get 7-zip or WinRar to unzip it. Each extension/theme has a manifest.json file. Open the manifest.json file in notepad. Then, if you know the coding, modify the code. There will be some other files. If you look in the manifest file you might be able to figure out what the are for. Then, you can change everything...
.CRX files are like .ZIP files, just change the extension and right click > Extract Files and you are done.
Once you have extracted files --> modify them and add to zip and change extension back to .crx.
Other way around --> Open Chrome --> Settings --> Extensions --> Enable Developer Options --> Load unpacked Extension (modified extracted files folder) and then click pack extension.
Source
Now Chrome is multi-user so Extensions should be nested under the OS user profile then the Chrome user profile, My first Chrome user was called Profile 1, my Extensions path was C:\Users\ username \AppData\Local\Google\Chrome\User Data\ Profile 1 \Extensions\.
To find yours Navigate to chrome://version/ (I use about: out of laziness).
Notice the Profile Path and just append \Extensions\ and you have yours.
Hope this brings this info on this question up to date more.
It's possible to modify the code of .CRX extension, because it's a simple .zip archive. You can download extension, extract it's source code, modify it (test and debug it as it's on your side), and package back into .CRX file.
I googled out this tool to simply download .CRX extension and extract the source code and it worked for me: http://crxextractor.com
Everything it does is parses .CRX file format and extracts actual .zip containing the source code.
If you have installed the Portable version of Chrome, or have it installed in a custom directory - the extensions won't be available in directory referenced in above answers.
Try right-clicking on Chrome's shortcut & Check the "Target" directory. From there, navigate to one directory above and you should be able to see the User Data folder and then can use the answers mentioned above