136

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"
  }
}
1

9 Answers 9

282

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 start -c

4
  • 59
    exp is now expo, r is short for start, and -c is short for --clear
    – tar
    Commented May 17, 2019 at 21:57
  • 17
    what if I don't want to start expo and just clean the cache?
    – xeruf
    Commented Aug 21, 2019 at 16:19
  • 3
    @kwoxer none of the above will remove actual React Native cache
    – d4rky
    Commented Sep 25, 2020 at 12:16
  • 4
    based on the new npx method, it is now npx expo start -c Commented Mar 26, 2023 at 6:31
50

The command to run is:

expo r -c

19

For Expo 45 and below

expo r -c

For Expo 46 and above

npx expo start --clear
1
  • npm start --reset-cache just gave me the error: There was a problem loading the project. This development build encountered the following error. Value of type java.lang.String cannot be converted to JSONObject. Commented Feb 3, 2023 at 17:30
6

In you console run:

expo start 

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

5

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

1
  • 1
    Is expo build:ios --clear-provisioning-profile the same as expo start --clean? Commented Oct 11, 2021 at 6:54
4

--clear-cache is a flag to clear cache before the build:

eas build -p android --clear-cache
eas build -p ios --clear-cache

all available flags, commands etc. you can see by input command:

eas build --help
3

2023 update

npx eas build -p ios --clear-cache

or

npx eas build -p android --clear-cache
2

npm start -c or npx expo start -c

0

It will clear the cache and start the project expo start -c

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.