-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Command 'wipe node_modules' failed with code: 1 #79
Comments
Is the |
No, it wasn't empty before I ran the command. Even after I encountered the error, the node_modules folder was present(typically it is deleted if the command succeeds). Although I did not check if it was empty after the error. I ended up deleting it manually in this case. |
I got the same error. node_modules is not empty before, but after running the command and getting this error, node_modules/.bin is gone, so no commands will work anymore, e.g |
A few questions:
Thanks. I can't seem to replicate it but let's get your feedback and fix this asap. |
UPDATE: Nevermind I think my ./gradlew folder just didn't exist. It would be nice if it skipped the step if the folder doesn't exist instead of erroring out just to avoid confusion hahaha. Getting error on react-native clean-project-auto
|
That makes sense. Yes, definitely think there should be a fallback. I’m also working on releasing a version that outputs a log file. A lot of times I can’t replicate the community’s problems so the log would help. |
@pmadruga, I believe this is a concurrency problem. It seems like if (options.getWipeiOSBuild()) {
executeTask(tasks.wipeiOSBuildFolder);
}
if (options.getWipeiOSPods()) {
executeTask(tasks.wipeiOSPodsFolder);
}
if (options.getWipeSystemiOSPodsCache()) {
executeTask(tasks.wipeSystemiOSPodsCache);
} In other words, we're trying to execute these tasks at the same time without knowing which one will be resolved/rejected first. This is causing node_modules to be removed before If I execute the process with flag |
I believe the tasks are mutually exclusive. But I'm puzzled by this:
Can someone in this thread that has this problem try the solution @OnurVar mentioned? Thanks! |
Node Version: v16.1.0 |
I'm getting a similar error:
Node version: 12.20.0 |
Just to give an update - I've been working on this fix (although I can't seem to replicate it). Progress is happening (despite being slightly slow). |
Hi everyone, As you know, I can't replicate it, but I've made the tasks truly asynchronous to avoid concurrency problems. For this, I need help with testing so please give it a go using
which will install version 4.0-alpha. One downside is that the tasks will take longer, but I'm investigating whether using threads will speed up the process. I also had to bump the minimum required node version, hence the jump to version 4 - but hopefully it won't cause breaking changes (min version of node is node >= 10). I also need a code review on #84. |
im getting this error in 1 project but not in another, even when i tried the same version. i downloaded the alpha version to try and it still fails for me:
|
Hi @Adnan-Bacic, thank you for testing the alpha! A few questions:
I've improved logging a bit on |
no problem, this is an awesome library 1: 2: but if i search my project for "hapi" i see if i search the project for "joi" i see and 3: error on 3.6.4:
not the same error as OP but others in the thread have gotten the same error. then i tried the 4.0.0-alpha1.0 and get the error from my previous comment. just tried 4.0.0-alpha2.0 and it also fails, results from 4.0.0-alpha2.0:
looks like its still complaining about joi |
Thank you for this. Let me investigate it more with this information and will work on alpha3. I'll write here as soon as I have a release. PS: The release of alpha2 only included better logging. |
Hi @pmadruga for the alpha version. I was able to test the alpha2 version and I think we're on right direction. I tested alpha version by applying some extra console logs to see if concurrency problem still exists or not. Here is where I've made the changes on my local
I ran
As you can see in the result, flags are logged after individual task executed respectively, which means concurrency problems is solved. I also run But when I ran
As you can see on the result, there is unhandled promise. Probably |
Firstly, thank you for the great debug session - it really helps in tackling this. Yes, I have the same gut feeling. From reading the code, I doubt that it's truly asynchronous. So in the next few days, I'm going to rewrite it and hopefully, alpha3 will have it fixed. I'll write here as soon as alpha3 is released. |
Alright, now alpha4 has some fixes! Please give it a go using:
Thank you! |
I've tested alpha4 and it seems like there is a problem in the order of autoTasks list:
I think this is the right order:
|
my error for 4.0.0-alpha3.0:
my error for 4.0.0-alpha4.0:
now its complaining about some "chalk" library. its not a dependency for the project but i see it in yarn.lock under a bunch of jest dependencies. |
When Do you get an error when running any of interactive/non-interactive? |
At which task is the error being thrown? |
clean android, every time |
Thanks. Now I'm just spitballing, but can you try |
i went with the ./gradlew cleanBuildCache not sure it does anything:
i then get the same error when running clean with auto. |
You're correct,node_modules folder should be created before |
@pmadruga I'm just joining into this conversation as another person experiencing the "clean android project" error.
After the above, I then performed the following using node
Here's my CLI output (when the execution broke, node_modules were not found): Executing fully-automated project clean.
Use 'react-native clean-project' for more control
Use `./node_modules/.bin/react-native-clean-project' for total control
ℹ️ STARTED: "wipe iOS build artifacts"
✅ FINISHED: "wipe iOS build artifacts" task has finished running in 4s.
ℹ️ STARTED: "wipe iOS Pods folder"
✅ FINISHED: "wipe iOS Pods folder" task has finished running in 12ms.
ℹ️ STARTED: "wipe system iOS Pods cache"
✅ FINISHED: "wipe system iOS Pods cache" task has finished running in 4s.
ℹ️ STARTED: "wipe user iOS Pods cache"
✅ FINISHED: "wipe user iOS Pods cache" task has finished running in 11ms.
ℹ️ STARTED: "wipe android build folder"
✅ FINISHED: "wipe android build folder" task has finished running in 10ms.
ℹ️ STARTED: "watchman cache clear (if watchman is installed)"
✅ FINISHED: "watchman cache clear (if watchman is installed)" task has finished running in 66ms.
ℹ️ STARTED: "wipe temporary caches"
✅ FINISHED: "wipe temporary caches" task has finished running in 17ms.
ℹ️ STARTED: "wipe node_modules"
✅ FINISHED: "wipe node_modules" task has finished running in 6s.
ℹ️ STARTED: "yarn cache clean (if yarn is installed)"
✅ FINISHED: "yarn cache clean (if yarn is installed)" task has finished running in 8s.
ℹ️ STARTED: "npm cache verify"
✅ FINISHED: "npm cache verify" task has finished running in 176s.
ℹ️ STARTED: "npm ci"
✅ FINISHED: "npm ci" task has finished running in 13ms.
ℹ️ STARTED: "clean android project"
node:internal/modules/cjs/loader:933
const err = new Error(message);
^
Error: Cannot find module 'chalk'
Require stack:
- /path/to/my/project/node_modules/@react-native-community/cli-tools/build/logger.js
- /path/to/my/project/node_modules/@react-native-community/cli-tools/build/index.js
- /path/to/my/project/node_modules/@react-native-community/cli/build/tools/config/errors.js
- /path/to/my/project/node_modules/@react-native-community/cli/build/tools/config/readConfigFromDisk.js
- /path/to/my/project/node_modules/@react-native-community/cli/build/tools/config/index.js
- /path/to/my/project/node_modules/@react-native-community/cli/build/commands/install/install.js
- /path/to/my/project/node_modules/@react-native-community/cli/build/commands/index.js
- /path/to/my/project/node_modules/@react-native-community/cli/build/index.js
- /path/to/my/project/node_modules/react-native/cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at _chalk (/path/to/my/project/node_modules/@react-native-community/cli-tools/build/logger.js:9:39)
at Object.error (/path/to/my/project/node_modules/@react-native-community/cli-tools/build/logger.js:46:22)
at handleError (/path/to/my/project/node_modules/@react-native-community/cli/build/index.js:101:24)
at Command.handleAction (/path/to/my/project/node_modules/@react-native-community/cli/build/index.js:189:7) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/path/to/my/project/node_modules/@react-native-community/cli-tools/build/logger.js',
'/path/to/my/project/node_modules/@react-native-community/cli-tools/build/index.js',
'/path/to/my/project/node_modules/@react-native-community/cli/build/tools/config/errors.js',
'/path/to/my/project/node_modules/@react-native-community/cli/build/tools/config/readConfigFromDisk.js',
'/path/to/my/project/node_modules/@react-native-community/cli/build/tools/config/index.js',
'/path/to/my/project/node_modules/@react-native-community/cli/build/commands/install/install.js',
'/path/to/my/project/node_modules/@react-native-community/cli/build/commands/index.js',
'/path/to/my/project/node_modules/@react-native-community/cli/build/index.js',
'/path/to/my/project/node_modules/react-native/cli.js'
]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
Looks like I'm also in the same boat using automatic cleaning on alpha4.0:
|
@roryabraham I can see that the alpha version solves this issue for you - can you confirm? |
For the rest, I'll keep investigating. Has anyone tried using |
Yes! After upgrading to |
Receiving this same error as Curt with regards to the 'chalk' module not being found. |
Same thing as @jwoo92 experiencing. Been working without any issues on a 100% clean project. |
Just spitballing here, but what happens if you install chalk and then run the clean script? |
running: running the before installing chalk it fails here:
so i tried to install chalk(5.0.0). 2 things happen:
however, i did eventually get tired of using the auto command, as i had to reinstall node_modules/ over and over again which took a lot of time, especially if you wanted to use the clean command multiple times per day. so i did switch to using a command which keeps node_modules/. the only thing is that not all commands are able to be specified, so i still have to manually answer some:
i see there is a discussion to make "keep" and "remove" possible, but thats another disucssion. |
Can you give it a go at PR #91, please? |
#91 works for me. |
excuse my ignorance, but am i supposed to just do the changes in the pr locally or do i have to do something to run a specific pr? i just did it manually, and #91 also works for me. |
Version 4.0.1 has now been pushed to master. I'll leave this thread open in case there are problems. |
if the node module is empty when we run this command, it won't even run because it can't find the package. |
When I run the command
npx react-native clean-project-auto
I get the following error and the process terminates.Library Version: 3.6.4
OS: macOS Big Sur 11.5.2
The text was updated successfully, but these errors were encountered: