Материал-интерфейс не может импортировать слайдер - PullRequest
0 голосов
/ 26 января 2020

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

возвращает ошибку при сборке

ERROR in ./src/components/StepSlider/StepSlider-view.jsx
Module not found: Error: Can't resolve '@material-ui/lab/Slider' in 'D:\GIT\...\components\StepSlider'
 @ ./src/components/StepSlider/StepSlider-view.jsx 2:0-45 29:26-32
 @ ./src/components/StepSlider/index.js
 @ ./src/components/plan_option_slider/PlanOptionSlider-view.jsx
 @ ./src/components/plan_option_slider/index.jsx
 @ ./src/features/plans/plans-view.jsx
 @ ./src/features/plans/index.jsx
 @ ./src/App.jsx
 @ ./src/index.jsx

Поиск этой ошибки говорит мне об установке lab, я уже это сделал, но решил, что дам это еще один шанс:

npm install @material-ui/lab

npm WARN bootstrap@4.4.1 requires a peer of popper.js@^1.16.0 but none is installed. You must install peer dependencies yourself.
npm WARN material-ui-pickers@2.2.4 requires a peer of @material-ui/core@^3.2.0 but none is installed. You must install 
peer dependencies yourself.
npm WARN restaurant_project@1.0.0 No description
npm WARN restaurant_project@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @material-ui/lab@4.0.0-alpha.40
updated 1 package and audited 12006 packages in 13.041s
found 0 vulnerabilities

Я следовал этому: npm WARN ... требуется одноранговый узел ... но ни один не установлен. Вы должны установить одноранговые зависимости самостоятельно (я был почти уверен, что все это установлено, но решил, что буду следовать указаниям)

npm install --save-dev popper.js@^1.16.0

npm WARN deprecated popper.js@1.16.0: Popper changed home, find its new releases at @popperjs/core
npm WARN material-ui-pickers@2.2.4 requires a peer of @material-ui/core@^3.2.0 but none is installed. You must install 
peer dependencies yourself.
npm WARN restaurant_project@1.0.0 No description
npm WARN restaurant_project@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ popper.js@1.16.0
updated 1 package and audited 12007 packages in 15.415s
found 0 vulnerabilities

npm install --save-dev @material-ui/core@^3.2.0

npm WARN @material-ui/icons@4.5.1 requires a peer of @material-ui/core@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @material-ui/lab@4.0.0-alpha.40 requires a peer of @material-ui/core@^4.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN restaurant_project@1.0.0 No description
npm WARN restaurant_project@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @material-ui/core@3.2.0
added 4 packages from 4 contributors, removed 26 packages, updated 5 packages and audited 11946 packages in 25.503s    
found 0 vulnerabilities

Это выглядит тревожно, похоже, что лаборатория запрашивает core4.9.0, но хорошо:

npm install --save-dev @material-ui/core@^4.0.0

npm WARN @material-ui/lab@4.0.0-alpha.40 requires a peer of @material-ui/core@^4.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN material-ui-pickers@2.2.4 requires a peer of @material-ui/core@^3.2.0 but none is installed. You must install 
peer dependencies yourself.
npm WARN restaurant_project@1.0.0 No description
npm WARN restaurant_project@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @material-ui/core@4.0.0
added 26 packages from 8 contributors, removed 6 packages, updated 1 package and audited 12027 packages in 14.485s     
found 0 vulnerabilities

Так что теперь это говорит мне Мне снова нужен @ material-ui / core @ ^ 3.2.0 - отлично, давайте посмотрим, смогу ли я это проигнорировать (это очистит только что установленный 4.9.0)

npm install --save-dev @material-ui/core@^4.9.0

npm WARN material-ui-pickers@2.2.4 requires a peer of @material-ui/core@^3.2.0 but none is installed. You must install 
peer dependencies yourself.
npm WARN restaurant_project@1.0.0 No description
npm WARN restaurant_project@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @material-ui/core@4.9.0
added 5 packages from 4 contributors, removed 3 packages, updated 5 packages and audited 12007 packages in 15.823s     
found 0 vulnerabilities

Хорошо, давайте посмотрим, смогу ли я построить его сейчас.

Без кубиков

ERROR in ./src/components/StepSlider/StepSlider-view.jsx
Module not found: Error: Can't resolve '@material-ui/lab/Slider' in 'D:\GIT\...\src\components\StepSlider'
 @ ./src/components/StepSlider/StepSlider-view.jsx 2:0-45 29:26-32
 @ ./src/components/StepSlider/index.js
 @ ./src/components/plan_option_slider/PlanOptionSlider-view.jsx
 @ ./src/components/plan_option_slider/index.jsx
 @ ./src/features/plans/plans-view.jsx
 @ ./src/features/plans/index.jsx
 @ ./src/App.jsx
 @ ./src/index.jsx

Я попробую обновить все:

npm update

npm WARN deprecated popper.js@1.16.1: Popper changed home, find its new releases at @popperjs/core
npm WARN material-ui-pickers@2.2.4 requires a peer of @material-ui/core@^3.2.0 but none is installed. You must install 
peer dependencies yourself.
npm WARN restaurant_project@1.0.0 No description
npm WARN restaurant_project@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ popper.js@1.16.1
updated 1 package and audited 12007 packages in 14.471s
found 0 vulnerabilities

построить снова:

без кубиков

ERROR in ./src/components/StepSlider/StepSlider-view.jsx
Module not found: Error: Can't resolve '@material-ui/lab/Slider' in 'D:\GIT\...\src\components\StepSlider'
 @ ./src/components/StepSlider/StepSlider-view.jsx 2:0-45 29:26-32
 @ ./src/components/StepSlider/index.js
 @ ./src/components/plan_option_slider/PlanOptionSlider-view.jsx
 @ ./src/components/plan_option_slider/index.jsx
 @ ./src/features/plans/plans-view.jsx
 @ ./src/features/plans/index.jsx
 @ ./src/App.jsx
 @ ./src/index.jsx

Я попробую с новым поппером

npm install @popperjs/core

npm WARN material-ui-pickers@2.2.4 requires a peer of @material-ui/core@^3.2.0 but none is installed. You must install 
peer dependencies yourself.
npm WARN restaurant_project@1.0.0 No description
npm WARN restaurant_project@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @popperjs/core@2.0.0
added 1 package from 1 contributor and audited 12008 packages in 19.887s
found 0 vulnerabilities

Я потерян, любая помощь будет ДЕЙСТВИТЕЛЬНО оценена

1 Ответ

0 голосов
/ 26 января 2020

https://material-ui.com/guides/migration-v3/

[Container] Moved from @material-ui/lab to @material-ui/core.

-import Container from '@material-ui/lab/Container';
+import Container from '@material-ui/core/Container';

после прочтения этого я проверил, чтобы они тоже двигались Slider.

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

должно быть

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

Надеюсь, это сэкономит кому-то еще время, которое я потратил

...