在開(kāi)發(fā)RN的程序時(shí)候,有時(shí)候會(huì)出現(xiàn)一種莫名其妙的Bug啊胶,程序報(bào)錯(cuò)提示
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start -- --reset-cache`.
根據(jù)提示處理后仍不能解決领追,后來(lái)偶爾發(fā)現(xiàn)默認(rèn)的8081端口被占用庶诡,程序無(wú)法啟動(dòng)
端口被占用.jpeg
調(diào)用命令發(fā)現(xiàn) 被64482進(jìn)程占用了
lsof -i :8081
kill掉進(jìn)程
kill -9 64482
然后執(zhí)行react-native run-ios
可以繼續(xù)愉快的玩耍了