Clean react native project

2019-06-18 05:37发布

问题:

How to clean react native project?

Is there any way to clean react native project as we can clean xcode project?

Any help will be appreciated!

回答1:

A react-native Project is about one XCode Project and one Android Project. (pure js code no need to do clean)

So what's you need would be

Clean XCode Project with

xcodebuild clean

And then clean Android Project with

./gradlew clean

You can simply write a batch file for it.



回答2:

For Android

cd android
gradlew clean

For IOS

cd ios
xcodebuild clean


回答3:

To reset react-native specific cache, run:

npm start -- --reset-cache

if in package.json you have

"scripts": {
  "start": "node node_modules/react-native/local-cli/cli.js start"
}


回答4:

Clean the Android Project with:

cd android/
gradlew clean


回答5:

React and node specific cleaning:

Remove node_modules to avoid inconsitence which may appear somehow rarely:

rm -rf node_modules

(reinstall if need with npm or yarn)

Clean npm cache if npm is used

npm cache clean

Clean react temp files:

rm -rf $TMP/react*


回答6:

remove android folder run

react-native upgrade

then

react-native run-android