BerryDevDev
BerryDevDev

Reputation: 107

This dependency was not found: *swiper/vue how to fix?

I'm scratching my head because I ran npm i swiper and read through the Swiper Vue docs and it says to import { Swiper, SwiperSlide } from 'swiper/vue which I've done and I even get the bundle size showing 95.4K (gzipped: 28.9K).

When I run npm run serve I then get this error

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

I for the life of me cannot figure out how to import that dependency.

Upvotes: 5

Views: 6729

Answers (2)

Alex Villarreal
Alex Villarreal

Reputation: 71

This worked for me, using Vue ^3.0.0 and Swiper ^8.0.6

import { Swiper, SwiperSlide } from "swiper/vue/swiper-vue";

import "swiper/swiper-bundle.css";

Upvotes: 7

Ruben
Ruben

Reputation: 606

If you're using the swiper version 7* then you could face this type of issue.

Github issue 4871

Try downgrading to the v6.7.5 , see if that helps.

Related issue

Upvotes: 5

Related Questions