How can I clean (reset cache) of React Native using Expo. Not sure if it is cache issue

React NativeExpoNpm Start

React Native Problem Overview


I am building a simple React Native app with create-react-native-app using only react-navigation and base-64(base 64 encode/decode) as dependencies. Over time starting the app became slower and now sometimes it is getting stuck(waiting for about 30min) on "Starting packager..." after running NPM start.

I've tried starting it with "npm start -- --reset-cache" but nothing changed

Once it is up and running I don't get any error or warning in DevTools or terminal. Also there are no issues with the performance of the app

What can I do to make NPM start smooth and quickly as before? Are there any general steps I can take to troubleshoot this issue?

Here is my package.json

{
  "name": "test",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "jest-expo": "~27.0.0",
    "react-devtools": "^3.2.3",
    "react-native-scripts": "1.14.0",
    "react-test-renderer": "16.3.1"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "jest"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "base-64": "^0.1.0",
    "expo": "^27.0.1",
    "react": "16.3.1",
    "react-native": "~0.55.2",
    "react-navigation": "^2.11.2"
  }
}

React Native Solutions


Solution 1 - React Native

expo r -c

According to this forum post from an Expo dev, that's the command to start it cache clean

EDIT: They have changed it from exp r -c to expo r -c

Solution 2 - React Native

The command to run is: > expo r -c

Solution 3 - React Native

In you console run:

expo start 

After the QR code is shown, press SHIFT + R keys.

Solution 4 - React Native

I was running expo build:ios and needed to clear the cached provisioning profile. I did so with:

expo build:ios --clear-provisioning-profile

To see the full list of commands that clear specific elements from the cache, run expo build:ios --help

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNedko DimitrovView Question on Stackoverflow
Solution 1 - React NativeSebastian BerglönnView Answer on Stackoverflow
Solution 2 - React NativeMitchell FryView Answer on Stackoverflow
Solution 3 - React Nativealejandro pereira ALEW140View Answer on Stackoverflow
Solution 4 - React NativeduhaimeView Answer on Stackoverflow