简体   繁体   English

尝试导入错误:“useControlled”未从“@material-ui/core/utils”导出

[英]Attempted import error: 'useControlled' is not exported from '@material-ui/core/utils'

./node_modules/@material-ui/lab/esm/useAutocomplete/useAutocomplete.js 
Attempted import error: 'useControlled' is not exported from '@material-ui/core/utils'.

Facing this issue , how to fix ?面对这个问题,如何解决?

corresponding versions对应版本

"@material-ui/core": "^4.8.3",
"@material-ui/lab": "^4.0.0-alpha.44",

Link for the component which i am using 我正在使用的组件的链接

You're using the latest version of the lab, but an older version of core.您使用的是最新版本的实验室,但使用的是旧版本的核心。 Switch to 4.9.4 for core and it should be fine.内核切换到 4.9.4 应该没问题。

missing some path缺少一些路径

Your import statement should be您的导入语句应该是

import useControlled from '@material-ui/core/utils/useControlled'

There is no index file in utils. utils 中没有索引文件。

Changing the the version of the packages didn't work for me.更改软件包的版本对我不起作用。 The issue was with the refrencing path in the import statement.问题在于导入语句中的引用路径。

replace代替

import Autocomplete from "@material-ui/lab";

with

import Autocomplete from "@material-ui/lab/Autocomplete";

try updating @material-ui/core by running尝试通过运行更新 @material-ui/core

npm update更新

这可能对您有用:

import { useControlled } from '@mui/material';

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试导入错误:“unstable_useId”未从“@material-ui/core/utils”导出(导入为“useId”) - Attempted import error: 'unstable_useId' is not exported from '@material-ui/core/utils' (imported as 'useId') 尝试导入错误:“ImageList”未从“@material-ui/core”导出 - Attempted import error: 'ImageList' is not exported from '@material-ui/core' 尝试导入错误:“ToogleButton”未从“@material-ui/lab”导出 - Attempted import error: 'ToogleButton' is not exported from '@material-ui/lab' 尝试导入错误:“useThemeVariants”未从“@material-ui/styles”导出 - Attempted import error: 'useThemeVariants' is not exported from '@material-ui/styles' 尝试导入错误:“fade”未从“@material-ui/core/styles”导出 - Attempted import error: 'fade' is not exported from '@material-ui/core/styles' 尝试导入错误:“alpha”未从“@material-ui/core/styles”导出 - Attempted import error: 'alpha' is not exported from '@material-ui/core/styles' 尝试导入错误:“makeStyles”未从“@material-ui/core/styles”导出 - Attempted import error: 'makeStyles' is not exported from '@material-ui/core/styles' 错误尝试导入错误:“NotificationsNoneIcon”未从“@material-ui/icons”导出 - error Attempted import error: 'NotificationsNoneIcon' is not exported from '@material-ui/icons' material-ui 'createSvgIcon' 未从 '@material-ui/core/utils' 导出 - material-ui 'createSvgIcon' is not exported from '@material-ui/core/utils' 尝试导入错误:“GlobalStyles”未从“@material-ui/system”导出(导入为“SystemGlobalStyles”) - Attempted import error: 'GlobalStyles' is not exported from '@material-ui/system' (imported as 'SystemGlobalStyles')
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM