简体   繁体   中英

Unable to install Material UI on new React app

I've just created a new React app using Create React App. When I went to install Matrial UI, I received the following error message:

Link to image of console

Other packages are able to be installed just fine. Is this an issue with React 17? Should I rollback to an earier version? I use React and Material UI daily at work, but this was on an app created back in June.

EDIT: I've attempted to delete the node modules folder and re-install, but no luck.

I think you just misspelled the command to install the package. You put: npm i npm install @material-ui/core You should insert: npm i @material-ui/core or npm install @material-ui/core

So it turns out the issue was caused by the fact that I was using the 'latest' version of Node, that being 15.0.1. I installed the LTS version, currently 12.19.0, and Material UI now installs and works correctly.

I got the same problem when I install it with NPM. I solved this issues with yarn instead of npm.

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