簡體   English   中英

當我安裝 material-UI 時,由 create-react-app 構建的 React(打字稿版本)應用程序中斷

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM