安装和使用聚合物元素后未捕获的 DOMException

uncaught DOMException after installing and using polymer element

我正在学习本教程,该教程教授如何安装聚合物元件: https://www.polymer-project.org/3.0/start/toolbox/add-elements

在 运行 npm install 命令之后并使用以下命令导入它:

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

我在页面加载时开始收到此错误:

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

我环顾四周,有人说删除节点模型文件夹,有人说重新安装 Web 组件,因为版本之间存在冲突,但 none 详细介绍了如何完成此操作。

对我来说,删除 node_modulespackage-lock.json,然后 运行 npm install 解决了这个问题。这似乎是由于纸张元素中的重复依赖性。