[英]React (typescript version) app build by create-react-app breaks when I install material-UI
I first used the command npx create-react-app my-app --template typescript
to make a react application, which worked fine and there was no error in the console.我首先使用命令
npx create-react-app my-app --template typescript
制作了一个反应应用程序,它工作正常并且控制台中没有错误。 then I executed npm install @material-ui/core
to install material UI and after installing material-UI my react application starts showing the following error然后我执行
npm install @material-ui/core
安装材料 UI 并在安装 material-UI 后我的反应应用程序开始显示以下错误
Could not find a declaration file for module 'react'. 'C:/Users/91727/OneDrive/Desktop/test/node_modules/react/index.js' implicitly has an 'any' type.\n If the 'react' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react`
Could not find a declaration file for module 'react/jsx-runtime'. 'C:/Users/91727/OneDrive/Desktop/test/node_modules/react/jsx-runtime.js' implicitly has an 'any' type.\n If the 'react' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react`
As suggested in conversation about this issue , try to install @material-ui/core
with --legacy-peer-deps
option:正如有关此问题的对话中所建议的那样,尝试使用
--legacy-peer-deps
选项安装@material-ui/core
:
npm install --save --legacy-peer-deps @material-ui/core
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.