# The CustomElementRegistry already contains an entry with the same name

**URL:** <https://forums.creativeclouddeveloper.com/t/the-customelementregistry-already-contains-an-entry-with-the-same-name/7860>\
**Category:** InDesign\
**Created:** [May 7, 2024, 3:06pm UTC](https://forums.creativeclouddeveloper.com/t/the-customelementregistry-already-contains-an-entry-with-the-same-name/7860 "2024-05-07T15:06:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roland\_Dreger](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/roland_dreger/32/3702_2.png) [@Roland\_Dreger](https://forums.creativeclouddeveloper.com/u/Roland_Dreger)\
**Post date:** [May 7, 2024, 3:06pm UTC](https://forums.creativeclouddeveloper.com/t/the-customelementregistry-already-contains-an-entry-with-the-same-name/7860/1 "2024-05-07T15:06:04Z")

</div>

Hi all,

when I try to integrate the Spectrum Web Component “Toast”, I get the following error message. I also had this with “Tags”.

```auto
uxp://uxp-internal/domjs_scripts.js:2 
Uncaught r_message: "The CustomElementRegistry already contains an entry with the same name."
_name: "NotSupportedError"code: (...)message: (...)name: (...)stack: "NotSupportedError: The CustomElementRegistry already contains an entry with the same name.\n at uxp://uxp-internal/domjs_scripts.js:2:61780\n at u (uxp://uxp-internal/domjs_scripts.js:2:61882)\n at Object.define (uxp://uxp-internal/domjs_scripts.js:2:62442)\n at node_modules/@spectrum-web-components/icons-ui/icons/sp-icon-cross75.js (./main.js:10471:20)\n at __init (./main.js:9:56)\n at node_modules/@swc-uxp-internal/toast/node_modules/@spectrum-web-components/button/src/CloseButton.js (./main.js:10644:5)\n at__init (./main.js:9:56)\n at node_modules/@swc-uxp-internal/toast/node_modules/@spectrum-web-components/button/sp-close-button.js (./main.js:10697:5)\n at __init (./main.js:9:56)\n at node_modules/@swc-uxp-internal/toast/src/Toast.js (./main.js:11104:5)"[[Prototype]]: Error

```

Imported Spectrum Web Compontents:

```auto
require("@spectrum-web-components/theme/sp-theme.js");
require("@spectrum-web-components/theme/src/themes.js");
require("@swc-uxp-wrappers/action-button/sp-action-button.js");
require("@swc-uxp-wrappers/toast/sp-toast.js");

```

Node modules:

 ![Bildschirmfoto 2024-05-07 um 16.57.51](https://us1.discourse-cdn.com/flex015/uploads/xdplugins/original/2X/1/1afde58c29143cc722f15a3b69e13d11ad517e55.png)

According to the documentation, sp-toast should be fully supported in InDesign: [https://developer.adobe.com/indesign/uxp/reference/uxp-api/reference-spectrum/swc/](https://developer.adobe.com/indesign/uxp/reference/uxp-api/reference-spectrum/swc/)

How does this name conflict come about? Does anyone have any idea why?

Roland

---

<div class="post-metadata">

**Author:** ![sttk3](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sttk3](https://forums.creativeclouddeveloper.com/u/sttk3)\
**Post date:** [May 8, 2024, 9:52am UTC](https://forums.creativeclouddeveloper.com/t/the-customelementregistry-already-contains-an-entry-with-the-same-name/7860/2 "2024-05-08T09:52:02Z")

</div>

Have had a similar problem. In my case, it happened when I was installing with npm even though yarn is recommended.

Once removed the `node_modules` folder and re-installed everything with yarn, it worked fine.

---

<div class="post-metadata">

**Author:** ![Roland\_Dreger](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/roland_dreger/32/3702_2.png) [@Roland\_Dreger](https://forums.creativeclouddeveloper.com/u/Roland_Dreger)\
**Post date:** [May 8, 2024, 12:39pm UTC](https://forums.creativeclouddeveloper.com/t/the-customelementregistry-already-contains-an-entry-with-the-same-name/7860/3 "2024-05-08T12:39:49Z")

</div>

Thanks for the tip! I will try yarn and give feedback.

Roland

---

<div class="post-metadata">

**Author:** ![Roland\_Dreger](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/roland_dreger/32/3702_2.png) [@Roland\_Dreger](https://forums.creativeclouddeveloper.com/u/Roland_Dreger)\
**Post date:** [May 9, 2024, 9:42am UTC](https://forums.creativeclouddeveloper.com/t/the-customelementregistry-already-contains-an-entry-with-the-same-name/7860/4 "2024-05-09T09:42:52Z")

</div>

With yarn, different versions of the SWC are imported in some cases. Unfortunately, it still does not work.

This is probably due to the icons. If I comment out the lines with e.g. customElements.define(“sp-icon-cross75”, IconCross75) in the bundled script, the error disappears. They are registered twice with the same name. But that is not a solution either.

Roland

---

<div class="post-metadata">

**Author:** ![sttk3](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sttk3](https://forums.creativeclouddeveloper.com/u/sttk3)\
**Post date:** [May 9, 2024, 10:44am UTC](https://forums.creativeclouddeveloper.com/t/the-customelementregistry-already-contains-an-entry-with-the-same-name/7860/5 "2024-05-09T10:44:57Z")

</div>

Unfortunately that is all the solution I know.
