How to clear react-native cache?

后端 未结 13 2208
傲寒
傲寒 2020-12-02 19:49

In react-native development, there are multiple caches used when the app is built:

  1. React-native packager cache
  2. Emulator cache
  3. Java side cache
13条回答
  •  广开言路
    2020-12-02 20:32

    You can clean cache in React Native >= 0.50 and npm > 5 :

    watchman watch-del-all && 
    rm -rf $TMPDIR/react-native-packager-cache-* &&
    rm -rf $TMPDIR/metro-bundler-cache-* && 
    rm -rf node_modules/ 
    && npm cache clean --force &&
    npm install && 
    npm start -- --reset-cache
    

    Apart from cleaning npm cache you might need to reset simulator or clean build etc.

提交回复
热议问题