查端口殺進(jìn)程
sudo lsof -i :8081
sudo kill -9 63
react-native start --port 9999
1、首先安裝nodejs会烙,根據(jù)官網(wǎng)的安裝就好了 https://reactnative.cn/docs/getting-started/
2负懦、其次采用webstorm開發(fā),比vscode省時(shí)省力很多
不然使用vscode會(huì)配置很多東西柏腻,各種報(bào)錯(cuò)
解決辦法
1 在 android/app/src/main 目錄下創(chuàng)建一個(gè) assets空文件夾
mkdir android/app/src/main/assets
2 在項(xiàng)目根目錄運(yùn)行
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
出現(xiàn)以下錯(cuò)誤的解決方式:
error listen EADDRINUSE: address already in use :::8081. Run CLI with --verbose flag for more details.
Error: listen EADDRINUSE: address already in use :::8081
react-native run-android命令改為react-native run-android --port 端口號(hào)
當(dāng)然可以直接運(yùn)行react-native run-android --port 端口號(hào) 這個(gè)命令node會(huì)自動(dòng)啟動(dòng)纸厉。
之后使用adb命令,映射端口號(hào)
adb reverse tcp:9999 tcp:8081
問題解決五嫂!
IOS遇到的65問題
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening HelloRn.xcworkspace. Run CLI with --verbose flag for more details.
sudo gem install cocoapods
cd ios
pod install
清除緩存
yarn start --reset-cache