執行react-native專案遇到的坑
最近接手了一個react-native專案,用xcode執行的時候,各種坑,各種報錯,現在抽時間整理一下
1.找不到標頭檔案 RCTJPushModule.h
一上來就報這個錯,翻閱一些資料找到解決辦法
開啟終端,cd到專案資料夾,輸入
npm install jpush-react-native jcore-react-native --save
2.“RCTBundleURLProvider.h” file not found
接著開始報這個檔案找不到,翻閱一些資料找到解決辦法
開啟終端,進入專案所在的資料夾目錄;把專案裡面的 node_modules 資料夾刪除掉,然後執行 npm install
3.shell Script invocation Error ,Command /bin/sh failed with exit code 2
Port 8081 already in use, packager is either not running or not running correctly
又出現了這個錯,都要崩潰了,不著急,找解決辦法
執行 react_native 時發生這個錯誤,解決辦法
關掉埠8081對應的程序打
開終端,輸入lsof -i:8081
出現下圖
殺掉程序28181:
kill 28181
重新執行專案
4.你以為這樣就可以了嗎,並沒有,“Installation Failed Invalid argument ”報錯
原因是“Bundle indentifier 置為空了”,把Bundle indentifier 填上就可以
5.緊接著是下圖的錯誤
開啟終端 cd到專案資料夾 npm install && react-native link
到這就差不多了,還有一些小問題,沒一一列出來