简体   繁体   中英

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.

I'd like to use the Mui Autocomplete component, but whatever I try I get this message:

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...

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. Actually, in this folder, my unstable_useId.js doesn't have its .d.ts one, so... Might it be the problem?

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM