Home > Blockchain >  Argument list too long - No command is working in VS Code
Argument list too long - No command is working in VS Code

Time:11-12

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.

Here is the error- enter image description here

I read a few solutions but I didn't understand all of them. Those are:

  1. 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?
  2. 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.
  3. 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-

enter image description here

What am I doing wrong or misunderstood?

CodePudding user response:

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.

  • Related