Service worker registration failed. Status code: 2
I'm getting the following error when using the content-react template from running npx extension create my-extension --template=content-react
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
devand then manually Load Unpacked onto Chrome - I
buildandstartthe 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
cc: @cezaraugusto :)
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
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:
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.
FYI, I opened a PR for the templates: https://github.com/extension-js/extension.js.org/pull/6
@abeisleem thanks! what OS are you using and which command are you running?
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 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!
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 v
9.12.2 - node v
20.16.0