[英]Attempted import error: 'unstable_useId' is not exported from '@material-ui/core/utils' (imported as 'useId')
I've just spent 3h trying to find a solution by myself, but I'm defintely stuck.我刚刚花了 3 小时试图自己找到解决方案,但我肯定被卡住了。
I'd like to use the Mui Autocomplete component, but whatever I try I get this message:我想使用 Mui Autocomplete 组件,但无论我尝试什么,我都会收到以下消息:
Failed to compile
./node_modules/@material-ui/lab/esm/useAutocomplete/useAutocomplete.js
Attempted import error: 'unstable_useId' is not exported from '@material-ui/core/utils' (imported as 'useId').
I already checked that my core and lab were up to date, but they are:我已经检查过我的核心和实验室是最新的,但它们是:
"@material-ui/core": "^4.9.11",
"@material-ui/lab": "^4.0.0-alpha.50",
And the weirdest is that it works like a charm on CodeSandBox with the very same setup...最奇怪的是,它在 CodeSandBox 上使用相同的设置就像一个魅力......
No idea if this is a clue or not, but I noticed that, in the folder utils
, almost every single file with a .js
extension has its "clone" with .d.ts
extension.不知道这是否是一个线索,但我注意到,在文件夹
utils
中,几乎每个扩展名为.js
的文件都有其扩展名为.d.ts
的“克隆”。 Actually, in this folder, my unstable_useId.js
doesn't have its .d.ts
one, so... Might it be the problem?实际上,在这个文件夹中,我的
unstable_useId.js
没有它的.d.ts
文件,所以......这可能是问题吗?
Thanks a lot: I hope I've been clear enough :)非常感谢:我希望我已经足够清楚了:)
change your @material-ui/lab module's version FROM "@material-ui/lab": "^4.0.0-alpha.50"
To: "@material-ui/lab": "4.0.0-alpha.46"
将 @material-ui/lab 模块的版本从
"@material-ui/lab": "^4.0.0-alpha.50"
为: "@material-ui/lab": "4.0.0-alpha.46"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.