簡體   English   中英

啟動 React Native 項目時出現莫名其妙的錯誤 - TypeError: undefined is not an object(評估 '_MaterialIcons.default.propTypes.style')

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

總結一下我嘗試無濟於事的步驟(沒有順序,我不記得了)......

  1. 刪除node_modulespackage.lock.jsonyarn.lock並運行npm iyarn
  2. 刪除ios/podsios/buildios/Podfile.lock並運行pod install
  3. 運行pod update
  4. 1和2的某種組合
  5. 運行npm uninstall material-icons
  6. 刪除了所有與節點相關和紗線相關的文件和目錄,並使用全新的 react-native 安裝重新開始
  7. 運行yarn cache clean
  8. 運行 killall -9 節點
  9. 運行npm audit -fix
  10. 重新啟動我的機器

我應該早點嘗試這個,但它最終在react-native-video-player中搞砸了。 他們必須最近添加了一些東西,因為我不久前成功使用了它。 當他們上傳已棄用的軟件包時一定會喜歡

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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