4

I'm trying to use react-slick inside my React project. When I try to import it

import Slider from 'react-slick';

I get this error

Cannot find module "react-slick"

Anyone else having this issue ?

https://github.com/akiran/react-slick Installation

npm install react-slick

Also install slick-carousel for css and font

npm install slick-carousel

React V "react@^15.4.1"

NPM install results

npm install react-slick --save
(node:14297) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[email protected] ..blal
└─┬ [email protected] 
  ├─┬ [email protected] 
  │ └── [email protected] 
  ├─┬ [email protected] 
  │ ├── [email protected] 
  │ └── [email protected] 
  └─┬ [email protected] 
    └── [email protected] 


npm install slick-carousel --save
(node:14298) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[email protected] ..blal
└── [email protected] 
7
  • There's not enough context to help you with this question. Can you show the output of the npm install react-slick and the package.json before and after? Jan 31, 2017 at 22:19
  • Just added the npm install results in the above post
    – me-me
    Jan 31, 2017 at 22:30
  • Great, looks normal -- what does the package.json look like? Could you also post the file you're importing the troublesome libraries into? Jan 31, 2017 at 22:50
  • what happens if you do var Slider = require('react-slick'); instead of import?
    – finalfreq
    Jan 31, 2017 at 23:17
  • Same thing when I use require like above. The file i'm importing into is just a regular js file with other imports that are fine. When I comment out the react-slick import all if fine again.
    – me-me
    Feb 1, 2017 at 0:03

6 Answers 6

4

Inside your react component file: import Slider from 'react-slick';

In package.json check version : "react-slick": "^0.15.4"

this is working for me.

3

I have faced the same problem. Please run the below command:-

yarn remove react-slick // If you installed through yarn

 or

npm uninstall react-slick // If you installed through npm

then run:-

npm install react-slick --save
1

This worked for me

rm -rf node_modules

delete package-lock.json

npm i
0

For me worked when I change from this

import Slider from "react-slick";

to this

import Slider from 'react-slick';

0

This works fine for me

npm uninstall react-slick --legacy-peer-deps 
-1

Uninstall and Install react-slick again. If that's not working, then check the modules in the package.json file:

"dependencies": {
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.3",
"react-slick": "^0.28.1",
"react-twitter-embed": "^3.0.3",
"reactjs-popup": "^2.0.5",
"slick-carousel": "^1.8.1"   }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.