pmadruga / react-native-clean-project

Automating the clean up of a React Native project
MIT License
1.19k stars 52 forks source link

UnhandledPromiseRejection: Command 'clean android project' failed with code: 1 #47

Closed aliceathens closed 2 years ago

aliceathens commented 3 years ago

Trying to use:

npx react-native-clean-project

Get the following error:

Screen Shot 2020-12-08 at 2 00 25 pm
pmadruga commented 3 years ago

Does it happen every time?

prescindivel commented 3 years ago

this error also happened to me

pmadruga commented 3 years ago

I'm not able to replicate this with a new RN project? Was that the case?

tolgaberk commented 3 years ago

is there any solution? it just happened to me.

(edit) i was just in the android dir thats why it thrown an error.

pmadruga commented 3 years ago

So this error happens when you're in the android directory? I'll give it a try tonight.

iamandiradu commented 3 years ago

Tried it after upgrading to RN 0.64.1. Had the same error as mentioned above. Ran yarn, retried cleaning and it worked.

apfritts commented 3 years ago

This is because you have removed your node_modules directory and your build.gradle file requires a resource in order to load your project and then clean your project.

Kailash23 commented 3 years ago

@pmadruga

> cwingsdeliveryapp@0.2.1 clean
> react-native-clean-project

Wipe iOS build folder? (Y/n) Y
Wipe iOS Pods folder? (Y/n) Y
Wipe system iOS Pods cache? (Y/n) Y
Wipe user iOS Pods cache? (Y/n) Y
Update pods? (Y/n) Y
Wipe android build folder? (Y/n) Y
Clean Android project? (Y/n) Y
Wipe node_modules folder? (Y/n) Y
Update brew? (Y/n) Y
✅  wipe iOS Pods folder task has finished running in 29ms.
✅  wipe android build folder task has finished running in 24ms.
✅  wipe temporary caches task has finished running in 17ms.
✅  watchman cache clear (if watchman is installed) task has finished running in 36ms.
✅  wipe user iOS Pods cache task has finished running in 2s.
Error running 'clean android project': 

Error running 'clean android project': FAILURE: Build failed with an exception.

Error running 'clean android project': * Where:

Error running 'clean android project': Script '/Users/kailashuniyal/Desktop/cwings-delivery-app/node_modules/react-native-unimodules/gradle.groovy' line: 168
Error running 'clean android project': 

* What went wrong:

Error running 'clean android project': A problem occurred evaluating settings 'CwingsDeliveryApp'.

Error running 'clean android project': > 
Error running 'clean android project': /Users/kailashuniyal/Desktop/cwings-delivery-app/node_modules/expo-camera/unimodule.json

Error running 'clean android project': * Try:

Error running 'clean android project': Run with --stacktrace option to get the stack trace. Run with --info
Error running 'clean android project':  or --debug option to get more log output. Run with 
Error running 'clean android project': --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 6s

❌  Command 'clean android project' failed with code: 1
node:internal/process/promises:245
          triggerUncaughtException(err, true /* fromPromise */);
          ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "undefined".] {
  code: 'ERR_UNHANDLED_REJECTION'
}
lulmichal commented 3 years ago

Hello,

I'm experiencing the same issue (React Native version is 0.63.4). @iamandiradu solution didn't work although I didn't yet update version.

Have a nice day.

MaganAnkur commented 3 years ago

I am experiencing the same issue with 0.66

pmadruga commented 2 years ago

Closing because the discussion has been moved to #79 . I've also released a potential fix - please check that thread. Thanks.