extension.js icon indicating copy to clipboard operation
extension.js copied to clipboard

Service worker registration failed. Status code: 2

Open abeisleem opened this issue 1 year ago • 6 comments

I'm getting the following error when using the content-react template from running npx extension create my-extension --template=content-react

image

I'm using it as is -- have not made any changes yet. This can be found by navigating to chrome://extensions and pressing the Reload icon on the extension.

That template comes with a background.ts file that has the below code that's not console logging:

console.log('Hello from the background script!')

The is not an issue when:

  • I run dev and then manually Load Unpacked onto Chrome
  • I build and start the extension.

System info: extension v2.0.0-alpha.8 pnpm v9.7.0 Chrome Version 128.0.6613.120 (Official Build) (64-bit)

PS. None of the template commands in https://extension.js.org/n/getting-started/templates work. I had to figure out that the template are named after the folders in https://github.com/extension-js/extension.js/tree/main/examples

abeisleem avatar Sep 02 '24 16:09 abeisleem

cc: @cezaraugusto :)

abeisleem avatar Sep 04 '24 13:09 abeisleem

hey @abeisleem thanks for trying Extension.js!

Regarding the templates, I still need to update the website. So far the v2.0.0 is taking all my free time. If you're feeling adventurous, I'd love to see a PR in https://github.com/extension-js/extension.js.org updating the template list.

Regarding the CLI not running, I just released 2.0.0-alpha.20, below a video of me running the template, seems fine for this release. Let me know if not. Don't forget the "@latest" part, npx cache is very consistent.

npx extension@latest create my-extension --template=content-react

https://github.com/user-attachments/assets/a07119bc-86a1-41fd-a810-22322b5e19fc

cezaraugusto avatar Sep 04 '24 22:09 cezaraugusto

Thanks @cezaraugusto!

I just gave this a try and created a new extension (at the time of running I got v2.0.0-alpha.22) and I'm getting the following error: image

I tried again with v2.0.0-alpha.22 and it lead to the same error. The extension manager is not running at all.

I noticed you're running dev with yarn, while I'm using pnpm. I imagine that shouldn't make a difference but pointing it out.

abeisleem avatar Sep 05 '24 07:09 abeisleem

FYI, I opened a PR for the templates: https://github.com/extension-js/extension.js.org/pull/6

abeisleem avatar Sep 05 '24 08:09 abeisleem

@abeisleem thanks! what OS are you using and which command are you running?

cezaraugusto avatar Sep 06 '24 00:09 cezaraugusto

My pleasure, @cezaraugusto! I'm using Windows 11 and the commands I'm running are npx extension create ... as shown above. And for development, I'm running pnpm dev which run extension dev that's in the package.json's scripts.

abeisleem avatar Sep 06 '24 07:09 abeisleem

@abeisleem sorry for the long delay! this should be fixed in the latest version which is v2.0.0-rc.23. if you ever get a chance to run this again and it doesn't work for some reason, please re-open. thanks!

cezaraugusto avatar Apr 09 '25 20:04 cezaraugusto

hey @cezaraugusto, thanks for the update! i just updated from 2.0.0-alpha.8 to 2.0.0-rc.23 and I'm still getting the same error.

i tried fixing by running the following commands

rm -rf node_modules/
rm pnpm-lock.yaml
pnpm store prune
rm -rf dist/

i'm using:

  • pnpm v9.12.2
  • node v20.16.0

Image

abeisleem avatar Apr 19 '25 01:04 abeisleem