How to clear react-native cache?

后端 未结 13 2186
傲寒
傲寒 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:36

    Clearing the Cache of your React Native Project:

    npm < 6.0 and RN < 0.50:

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

    npm >= 6.0 and RN >= 0.50:

     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
    

提交回复
热议问题