![](/img/trans.png)
[英]Error PropTypes React Native undefined is not an object (evaluating '_propTypes.default.nymber.isRequired')
[英]Inexplicable Error When Starting React Native Project - TypeError: undefined is not an object (evaluating '_MaterialIcons.default.propTypes.style')
我在我的項目中工作沒有問題,我安裝的最后一件事是react-native-video-player
,一切運行良好。 我遇到了一個正常的錯誤,我認為這是我剛剛添加的一個錯字,很簡單,它按預期關閉了應用程序。 我修復了錯誤並嘗試再次啟動項目,但出現以下錯誤,如標題所示...
TypeError: undefined is not an object (evaluating '_MaterialIcons.default.propTypes.style')
然后,當我無法訪問的文件中的某些內容出現竊聽時,我嘗試了通常的一系列嘗試。 我刪除node_modules
和我的package.lock.json
並重新運行npm i.
我一直收到同樣的錯誤,然后是幾個不同的錯誤。 在嘗試了許多解決方案后,卸載了我認為是罪魁禍首的不同 npm 包,但沒有成功。 我得到錯誤的方式以及發生最初錯誤的任何錯誤都在不斷變化,但現在我碰壁了。 電話模擬器白屏,我在 Metro Bundle 終端中收到以下三個錯誤:
TypeError: undefined is not an object (evaluating '_MaterialIcons.default.propTypes.style')
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
I then created a new branch where I deleted node_modules
, package.lock.json
, yarn.lock
, and even my package.json
. 然后,當我嘗試使用npx react-native run-is
啟動應用程序時,我收到了安裝 React Native 的預期提示。 我做了,它安裝了。 安裝后,我得到了同樣的錯誤,如果我搜索與錯誤有關的單詞 - 什么都沒有。 如果我嘗試搜索發生錯誤的頁面 - 什么都沒有。 所以這意味着它必須在node_modules
中,因為這些是唯一沒有被搜索到的文件。 I truly have no idea how to solve this, as I haven't used material icons anywhere (including my yarn.lock
, my package.json
, and my package.lock.json
)
總結一下我嘗試無濟於事的步驟(沒有順序,我不記得了)......
node_modules
, package.lock.json
和yarn.lock
並運行npm i
和yarn
ios/pods
和ios/build
和ios/Podfile.lock
並運行pod install
pod update
npm uninstall material-icons
yarn cache clean
npm audit -fix
我應該早點嘗試這個,但它最終在react-native-video-player
中搞砸了。 他們必須最近添加了一些東西,因為我不久前成功使用了它。 當他們上傳已棄用的軟件包時一定會喜歡
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.