Search code examples
javascriptpolymer

uncaught DOMException after installing and using polymer element


I am following this tutorial which teaches the installation of polymer elements: https://www.polymer-project.org/3.0/start/toolbox/add-elements

After running the npm install command and importing it using:

import '@polymer/paper-checkbox/paper-checkbox.js';

I am starting to get this error when the page loads:

Uncaught (in promise) DOMException: Failed to execute 'define' on 'CustomElementRegistry': this name has already been used with this registry

I had a look around and some say delete node models folder and others say to reinstall web components because there are conflicts between versions but none go into great detail on how this is done.


Solution

  • For me, deleting node_modules and package-lock.json, then running npm install fixed this. It appears to be due to duplicate dependencies within paper elements.