React Native 的缓存对编译影响很大,更改了项目路径都有可能导致编译错误。
如何彻底清除缓存,重新编译项目?
cd path/to/project
rm -rf ~/.rncache
rm package-lock.json
sudo rm $TMPDIR/*
sudo rm -rf $TMPDIR/*
watchman watch-del-all
watchman watch-del-all
rm yarn.lock
rm -rf node_modules/
rm -rf ios/build
#install node_modules
yarn
react-native link
cd ios
rm -Rf Pods
rm Podfile.lock
rm -Rf youriosproject.xcworkspace
pod install
#run simulator
cd ..
react-native run-ios