我的ReactNative項目運行出現過的報錯——解決方法總結

  1. 錯誤信息:the development server returned response error code:500紅屏error code:500
    解決:查看服務器的報錯,會具體到項目的某個文件,某個地方。
    我這裏是語法錯誤,還有少後綴的都遇到過,編譯不通過,都是沒注意的錯誤,修改好就OK了。
    有時項目卡住也這樣,解決:
//打開cmd 運行
react-native start --reset-cache
 
// 再打開另一個 cmd 運行
 
react-native run-android
I did react-native start --reset-cache as proposed, 
and then in another terminal window 
I did react-native run-ios and Problem Solved.

https://github.com/facebook/react-native/issues/21530
參考他的解決方法

  1. 錯誤信息:Element type is incalid:expected a string or a class/function but got undefined.
    You forget to export your component…
    我哭了,,我定義了,export了啊!。。。
    其實最後發現是引錯了。
    解決undefined就是組件找不到,組件export錯或import錯了,沒有找到。修改正確吧
    在這裏插入圖片描述
    3.報錯一直顯示在render上,expected";",可是實際錯誤,!!!是大括號寫錯了位置。這個報錯可真的太沒針對性了。
    在這裏插入圖片描述
    解決:class的大括號弄錯位置,到render之前了。粗心!

  2. 這是內存不足安裝失敗的提示:
    Failed to finalize session : INSTALL_FAILED_INSUFFICIENT_STORAGEExecution failed for task ':app:installDebug'.
    解決:手機上的垃圾清理一下,就好了,哈哈。。。這個錯誤,好尷尬!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章