Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't resolve '@material-ui/lab/Slider' in {path}

I imported the Slider:

import Slider from '@material-ui/lab/Slider';

and have returned in the render.

The code is not getting compiled and is throwing an error:

Module not found: Error: Can't resolve '@material-ui/lab/Slider' in {path}.

Could anyone help me with this? Thanks.

like image 574
technoite Avatar asked Sep 14 '18 11:09

technoite


4 Answers

You have to install the lab package: npm install @material-ui/lab

like image 95
Pedro Brost Avatar answered Nov 13 '22 03:11

Pedro Brost


Updated answer as of February 2021: Slider has been moved into core, so you should change your import to:

import Slider from '@material-ui/core/Slider';
like image 39
Bluby Avatar answered Nov 13 '22 04:11

Bluby


Run the following command in the your terminal/ cmd :

npm install @material-ui/lab

After successful installation, restart the server. It will work properly. You can check manually in your node_modules/@material-ui. You will find lab folder in it.

like image 1
Rishav Kumar Avatar answered Nov 13 '22 03:11

Rishav Kumar


Error itself shout a lot.

Module not found

That means you've to install the module if its not part of your project.

lab doesn't come with material/core

Just install the lab package through any package manager NPM or YARN

npm

npm install @material-ui/lab

yarn

yarn add @material-ui/lab

I would suggest to use only one package at a time, And also check if the lock file exist. Sometimes it conflicts and cause issue with the existing packages.

like image 1
Hidayt Raj Avatar answered Nov 13 '22 03:11

Hidayt Raj