Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while clean android project #55

Merged
merged 2 commits into from
Jul 21, 2021
Merged

Conversation

r0b0t3d
Copy link
Contributor

@r0b0t3d r0b0t3d commented May 5, 2021

Issue

Error running 'clean android project': Could not read script '/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' as it does not exist.

Root cause

If Wipe node_modules folder? is Yes, node_module will be deleted

Solution

Make sure to execute cleanAndroidProject task after yarnInstall

source/index.js Outdated
.then(() => options.getUpdatePods() && executeTask(tasks.updatePods))
.catch(() => {
console.log(
'❌ Examine output - error in either yarn cache clean, yarn install, or pod update'
);
});
} else if (options.getCleanAndroidProject()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a switch-case would fit better to prevent starting a cascade of else-if's?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pmadruga I'm not sure that I get what you mean. But I updated the logic here. Actually, updatePods and cleanAndroidProject requires node_modules. So I just make sure that node_modules existed then run cleanAndroidProject and updatePods. Please help review it. Thanks

.catch(() => {
console.log(
'❌ Examine output - error in either yarn cache clean, yarn install, or pod update'
);
});
}
prepareNodeModulesTask
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this live inside the last thenable before the catch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pmadruga yes it can, but it will not be executed if options.getWipeNodeModules() is false.

@Domeee
Copy link

Domeee commented Jul 20, 2021

@pmadruga @r0b0t3d hey guys. thank you for your work on react-native-clean-project! i am a new user and the cli is failing for me because of this issue. any update on this matter?

@r0b0t3d
Copy link
Contributor Author

r0b0t3d commented Jul 20, 2021

@Domeee just try my branch to see if it works for you

yarn add -D https://github.com/r0b0t3d/react-native-clean-project.git

@Domeee
Copy link

Domeee commented Jul 20, 2021

@r0b0t3d Thank you. Here are the results:

  • input (Y/n) is not treated case-insensitive
  • npm deprecations treated as errors

Besides those two findings, the cli ran without problems.

npx react-native clean-project
[INSERT] [develop] Wipe iOS build folder? (Y/n) n
Wipe iOS Pods folder? (Y/n) n
Wipe system iOS Pods cache? (Y/n) n
Wipe user iOS Pods cache? (Y/n) n
Update pods? (Y/n) n
Wipe android build folder? (Y/n) y
🚫 Please select 'Y' for yes, or 'n' for no.
Wipe android build folder? (Y/n) y
🚫 Please select 'Y' for yes, or 'n' for no.
Wipe android build folder? (Y/n) Y
Clean Android project? (Y/n) y
🚫 Please select 'Y' for yes, or 'n' for no.
Clean Android project? (Y/n) Y
Wipe node_modules folder? (Y/n) y
🚫 Please select 'Y' for yes, or 'n' for no.
Wipe node_modules folder? (Y/n) Y
Update brew? (Y/n) n
✅  wipe android build folder task has finished running in 37ms.
✅  watchman cache clear (if watchman is installed) task has finished running in 29ms.
✅  wipe temporary caches task has finished running in 22ms.
✅  wipe node_modules task has finished running in 1s.
✅  yarn cache clean (if yarn is installed) task has finished running in 4ms.
✅  npm cache verify task has finished running in 44s.
Error running 'npm ci': npm
Error running 'npm ci':  WARN deprecated deep-assign@3.0.0: Check out `lodash.merge` or `merge-options` instead.

Error running 'npm ci': npm
Error running 'npm ci':  WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated

Error running 'npm ci': npm
Error running 'npm ci':  WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated

Error running 'npm ci': npm
Error running 'npm ci':  WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added

Error running 'npm ci': npm
Error running 'npm ci':  WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

Error running 'npm ci': npm
Error running 'npm ci':  WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0

✅  npm ci task has finished running in 7s.
✅  yarn install (if yarn is installed) task has finished running in 4ms.
✅  clean android project task has finished running in 4s.

@pmadruga pmadruga merged commit 9ecb876 into pmadruga:master Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants