thomasloven / lovelace-card-mod

🔹 Add CSS styles to (almost) any lovelace card
MIT License
1.12k stars 167 forks source link

error when using as frontend module: name "mod-card" has already been used with this registry #174

Closed ktownsend-personal closed 2 years ago

ktownsend-personal commented 2 years ago

My Home Assistant version: 2021.12.8

My lovelace configuration method (GUI or yaml): yaml

What I am doing: configuring card-mod as frontend module

What I expected to happen: no errors

What happened instead: This error in browser, plus a corresponding log entry:

Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "mod-card" has already been used with this registry
    at http://homeassistant:8123/hacsfiles/lovelace-card-mod/card-mod.js?hacstag=190927524311:6:10674

Minimal steps to reproduce:

# The least amount of code possible to reproduce my error
frontend:
  themes: !include_dir_merge_named themes/
  extra_module_url: /hacsfiles/lovelace-card-mod/card-mod.js
# End of code

Error messages from the browser console: Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "mod-card" has already been used with this registry at http://homeassistant:8123/hacsfiles/lovelace-card-mod/card-mod.js?hacstag=190927524311:6:10674


By putting an X in the boxes ([]) below, I indicate that I:

allflame commented 2 years ago

I'm having this issue when using mixed mode configuration, e.g.

lovelace:
  mode: storage
  resources:
    ...
    /hacsfiles/lovelace-card-mod/card-mod.js
    ...
  dashboards:
    my-dashborad:
      mode: yaml

IF i switch to complete manual mode, problem disappears

Maybe this helps

michapr commented 2 years ago

I have same issue (with same link in error message). And I do not used "mixed configuration" (all in manual mode).

Thanks for help!

Stooovie commented 2 years ago

Same issue

florianec commented 2 years ago

I have the same error but it seems "expected"

The error can be safely ignored. I'll make sure it's removed for the next release.

Originally posted by @thomasloven in https://github.com/thomasloven/lovelace-card-mod/issues/159#issuecomment-975350355

thomasloven commented 2 years ago

Should be gone now.

ktownsend-personal commented 2 years ago

@thomasloven thank you. It appears resolved for me.

shred86 commented 2 years ago

Unfortunately still receiving this same exact error. This is with using a lovelace design by matt0707.

card-mod was installed through HACS. The only slight difference I see is:

frontend:
  extra_module_url:
    - /hacsfiles/lovelace-card-mod/card-mod.js

This is defined in include/themes.yaml instead of the configuration.yaml file, but as far as I know, that shouldn’t matter.