![](/img/trans.png)
[英]How do I override Material-UI with css modules in create-react-app and Typescript?
[英]React (typescript version) app build by create-react-app breaks when I install material-UI
我首先使用命令npx create-react-app my-app --template typescript
制作了一個反應應用程序,它工作正常並且控制台中沒有錯誤。 然后我執行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`
正如有關此問題的對話中所建議的那樣,嘗試使用--legacy-peer-deps
選項安裝@material-ui/core
:
npm install --save --legacy-peer-deps @material-ui/core
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.