npm错误!解析时:@material-ui/core@4.12.4

6za6bjd0  于 2023-04-30  发布在  其他
关注(0)|答案(1)|浏览(171)

在将React应用部署到Azure应用服务时,我们收到此错误,直到昨天这一直工作得很好,我们没有任何新的更新到包。配置

3:58:19 PM envoy-beta: Running 'npm install'...
3:58:25 PM envoy-beta: npm ERR! code ERESOLVE
3:58:25 PM envoy-beta: npm ERR! ERESOLVE could not resolve
3:58:25 PM envoy-beta: npm ERR! 
3:58:25 PM envoy-beta: npm ERR! While resolving: @material-ui/core@4.12.4
3:58:25 PM envoy-beta: npm ERR! Found: @types/react@18.0.21
3:58:25 PM envoy-beta: npm ERR! node_modules/@types/react
3:58:25 PM envoy-beta: npm ERR!   @types/react@"^18.0.8" from the root project
3:58:25 PM envoy-beta: npm ERR!   peerOptional @types/react@"*" from @material-ui/types@5.1.0
3:58:25 PM envoy-beta: npm ERR!   node_modules/@material-ui/types
3:58:25 PM envoy-beta: npm ERR!     @material-ui/types@"5.1.0" from @material-ui/core@4.12.4
3:58:25 PM envoy-beta: npm ERR!     node_modules/@material-ui/core
3:58:25 PM envoy-beta: npm ERR!       @material-ui/core@"^4.12.4" from the root project
3:58:25 PM envoy-beta: npm ERR!       1 more (@material-ui/lab)
3:58:25 PM envoy-beta: npm ERR!     @material-ui/types@"5.1.0" from @material-ui/styles@4.11.5
3:58:25 PM envoy-beta: npm ERR!     node_modules/@material-ui/styles
3:58:25 PM envoy-beta: npm ERR!       @material-ui/styles@"^4.11.5" from @material-ui/core@4.12.4
3:58:25 PM envoy-beta: npm ERR!       node_modules/@material-ui/core
3:58:25 PM envoy-beta: npm ERR!         @material-ui/core@"^4.12.4" from the root project
3:58:25 PM envoy-beta: npm ERR!         1 more (@material-ui/lab)
3:58:25 PM envoy-beta: npm ERR!   14 more (@mui/base, @mui/icons-material, @mui/lab, @mui/material, ...)
3:58:25 PM envoy-beta: npm ERR! 
3:58:25 PM envoy-beta: npm ERR! Could not resolve dependency:
3:58:25 PM envoy-beta: npm ERR! peerOptional @types/react@"^16.8.6 || ^17.0.0" from @material-ui/core@4.12.4
3:58:25 PM envoy-beta: npm ERR! node_modules/@material-ui/core
3:58:25 PM envoy-beta: npm ERR!   @material-ui/core@"^4.12.4" from the root project
3:58:25 PM envoy-beta: npm ERR!   peer @material-ui/core@"^4.12.1" from @material-ui/lab@4.0.0-alpha.61
3:58:25 PM envoy-beta: npm ERR!   node_modules/@material-ui/lab
3:58:25 PM envoy-beta: npm ERR!     @material-ui/lab@"^4.0.0-alpha.61" from the root project

已经尝试过的

  1. npm install --legacy-peer-deps
  2. npm install --legacy-peer-deps --force
  3. npm install --force
    1.我们完全删除了node_modules并重新安装了它们
    感谢任何帮助
brccelvz

brccelvz1#

也许,您安装的@types/react版本18在material-ui版本4中不受支持。
所以你必须降级@types/react v17或升级Material ui版本5。
https://dev.to/ifeanyichima/how-to-downgrade-from-react-18-to-1702-818

相关问题