Issue
I am getting this Argument list too long
error whenever, I run any command in VS code.
All commands are working in the Linux default terminal but nothing is working in VS code terminal.
I read a few solutions but I didn't understand all of them. Those are:
Remove the entire directory and recreate it.
- How this can be a solution because this error is happening in all projects. Would I remove all project directories and recreate them?
Mass delete files using the find method?
- My all projects are cloned from git. Even if I delete all files of a project then to recreate them, I need to re-clone which I tried, and that is not working.
Change the limit using the command -
ulimit -s <any_number_greater_than_current_limit>
- It didn't work.
I checked my max limit of arguments, using those two commands-
What am I doing wrong or misunderstood?
Solution
As I mentioned in the question, I tried several ways which didn't work for me.
In my case, I checked the .bashrc
file and found that the PATH
variable was exported almost 10000+ times like that-
export PATH="$PATH:$HOME/.composer/vendor/bin/
export PATH="$PATH:$HOME/.composer/vendor/bin/
export PATH="$PATH:$HOME/.composer/vendor/bin/
export PATH="$PATH:$HOME/.composer/vendor/bin/
...
...
...
That is what consumed the space and make the memory full to run any further commands even with 0 arguments.
I removed all and added the following script to define PATH
only when not added already.
[[ $PATH =~ (^|.*:)"$HOME/.composer/vendor/bin"($|:.*) ]] || PATH=$PATH:$HOME/.composer/vendor/bin
I reload the shell then and it worked.
Thanks, @CharlesDuffy for your suggestions.
Answered By - Neha Soni Answer Checked By - Clifford M. (WPSolving Volunteer)