开发者

Why can't I create a Google Chrome extension from the CLI?

开发者 https://www.devze.com 2023-02-12 06:49 出处:网络
I\'m a bit confused, but I can\'t create a .crx package from the CLI in Linux开发者_运维技巧. In Windows 7 the script worked fine, but in Linux it seems that nothing happens. The popup window that occ

I'm a bit confused, but I can't create a .crx package from the CLI in Linux开发者_运维技巧. In Windows 7 the script worked fine, but in Linux it seems that nothing happens. The popup window that occurs after the packaging process doesn't appear and the .crx is not created at all.

Here's the script.

#!/bin/sh

google-chrome --pack-extension=~/Web/client/ --pack-extension-key=~/Web/client.pem
exit 0

Maybe I'm missing something?


In Linux, (at least Ubuntu 10.04) google-chrome is a bash script wrapper of the chrome executable.

First, You should find where the chrome executable is. In my case: /opt/google/chrome/chrome

Then, replace it in your script:

#!/bin/sh

/opt/google/chrome/chrome --no-message-box --pack-extension=/extfolder/Web/client/ --pack-extension-key=/extfolder/Web/client.pem
exit 0

It is really important that in the script to specify the full path. For instance, /home/me/Web/client.pem rather than ~/Web/client.pem because as it is a parameter bash does not resolve it.

A better alternative would be defining a bash variable called $CHROME_PATH so it can be easily changed among different *nix platforms.


I don't know why packaging with google-chrome on Linux doesn't work, but can at least propose a workaround - use one of the officially-blessed packaging scripts listed at https://developer.chrome.com/extensions/crx#scripts. There is currently one for Bash and one for Ruby.

0

精彩评论

暂无评论...
验证码 换一张
取 消