【问题标题】:This dependency was not found: *swiper/vue how to fix?未找到此依赖项:*swiper/vue 如何修复?
【发布时间】:2021-11-24 00:11:11
【问题描述】:

我摸不着头脑,因为我跑了 npm i swiper 并通读了 Swiper Vue 文档,它告诉 import { Swiper, SwiperSlide } from 'swiper/vue 我已经完成了,我什至得到了显示 95.4K (gzipped: 28.9K) 的包大小。

当我运行 npm run serve 时,我会收到此错误

This dependency was not found:

* swiper/vue in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader-v16/dist??ref--0-1!./src/views/Home.vue?vue&type=script&lang=js

To install it, you can run: npm install --save swiper/vue

我一辈子都不知道如何导入该依赖项。

【问题讨论】:

    标签: javascript node.js vue.js webpack vue-component


    【解决方案1】:

    如果您使用的是 swiper 版本 7*,那么您可能会遇到此类问题。

    Github issue 4871

    尝试降级到 v6.7.5 看看是否有帮助。

    Related issue

    【讨论】:

    • 在我发布这篇文章后,我更深入地阅读了 Swiper 的 GitHub 问题,这绝对是解决方法!谢谢你的回复?
    猜你喜欢
    • 2019-02-14
    • 2021-11-09
    • 2019-02-24
    • 2021-06-16
    • 1970-01-01
    • 2021-05-15
    • 2022-01-01
    • 2019-10-22
    • 2021-10-27
    相关资源
    最近更新 更多