【问题标题】:ERROR in Error: Metadata version mismatch for module ngx-swiper-wrapper found version 4, expected 3错误中的错误:模块 ngx-swiper-wrapper 的元数据版本不匹配发现版本 4,预期为 3
【发布时间】:2018-07-06 16:48:10
【问题描述】:

我正在使用 swiper 模块,它在安装时运行良好,但是当我重新为项目提供服务时,我遇到了错误: The plugin link

错误中的错误:模块的元数据版本不匹配 E:/xampp/htdocs/havemybooks/node_modules/ngx-swiper-wrapper/dist/ng x-swiper-wrapper.d.ts,找到版本 4,预期为 3,解析符号 E:/xampp/htdocs/havemybooks/src/中的组件模块 app/component/component.module.ts,解析符号ComponentModule在 E:/xampp/htdocs/havemybooks/src/app/component/com ponent.module.ts

这是我ng -v的结果

@angular/cli: 1.4.2
node: 6.10.3
os: win32 x64
@angular/animations: 4.4.5
@angular/common: 4.4.5
@angular/compiler: 4.4.5
@angular/core: 4.4.5
@angular/forms: 4.4.5
@angular/http: 4.4.5
@angular/platform-browser: 4.4.5
@angular/platform-browser-dynamic: 4.4.5
@angular/router: 4.4.5
@angular/cli: 1.4.2
@angular/compiler-cli: 4.4.5
@angular/language-service: 4.4.5
typescript: 2.3.4

【问题讨论】:

  • ngx-swiper-wrapper 版本降级到3可以吗?
  • 是的,我可以,但我不知道他们的版本 3 是什么特定版本,他们的版本控制就像我安装的 5.3.0,所以不知道他们的版本 3 是什么。此外,我认为错误与角度版本有关,这是我看到的唯一 4 个(大声笑)

标签: javascript angular node-modules


【解决方案1】:

打开一个issue后发现这个错误是版本问题造成的,因为版本5中的大部分插件与版本4不兼容。

要么使用this 将您的项目从 4 更新到版本 5,这可能会很耗时,因为您的项目可能具有仅与 v4 兼容的依赖项,因此我不想这样做。

我最终使用以下方法安装了旧版本的插件:

npm install ngx-swiper-wrapper@prev --save

同样可以使用GitHub 中的releases 部分安装工作的旧版本,或者通过文档进行安装,因为大多数插件都会引用旧版本。

同样,对于另一个插件,我遇到了使用相同方法解决的问题。Consider this issue

更新:几个月后,我想建议升级您的项目本身。只需在升级到最新的 Angular 版本(截至目前为 6可能会随着新版本的功能发生变化,所以不要忘记检查它们)。我知道首先感觉很难,但我可以向您保证,为您的旧项目找到合适的版本不会花费您那么多。

【讨论】:

    猜你喜欢
    • 2018-09-16
    • 2020-01-09
    • 1970-01-01
    • 2018-06-11
    • 1970-01-01
    • 2018-05-12
    • 2018-04-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多