user image

Mohamed Atef
Published in : 2021-10-03

Module not found: Can't resolve 'swiper' in Reactjs [Solved]

React js

Swiper is not working in Reactjs 

Module not found: Can't resolve 'swiper' This error is happening when I try to import the swiper component to use it however I did everything as it exists in the documentation !! 
All I did is installing the package using this command 

npm i swiper

then import the module in the component 
like this 

import { Swiper, SwiperSlide } from 'swiper/react';

Once I add the line above I start getting this error !!!! 
Anyone can help?

— Solved

I tried a lot of solutions on the internet but no one works for me I still getting this error, so I start thinking about this is an error from the package itself, so I used an older version from the package using this command 

npm install swiper@6.8.4

when I did this, I saw a new folders has been added to the swiper folder in the node_modules and the website start working without no problem :)


nico Date : 2022-02-19

Best answers


Best answers


Hello Mohamed it seems to be fixed on the version 8.0.6
I did try it and didn't get the error. :)

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

TypeError: Cannot read properties of null (reading 'scrollTop') in jest
Publish date: 2022-09-08 | Comments: 1

Tag: React js

Reload browser window using Reactjs?
Publish date: 2022-02-08 | Comments: 4

Tag: React js

[Solved] Cannot read properties of null (reading 'getBoundingClientRect')
Publish date: 2021-12-02 | Comments: 2

Tag: React js

React usestate array map() is not working
Publish date: 2022-04-22 | Comments: 3

Tag: React js

How to use Datepick of Mui with Formik
Publish date: 2022-02-14 | Comments: 7

Tag: React js

[solved] Expected a conditional expression and instead saw an assignment
Publish date: 2021-11-29 | Comments: 0

Tag: React js

[solved] Render/Show a custom option in Autocomplete Material UI?
Publish date: 2021-12-22 | Comments: 2

Tag: React js