You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting "The command line is too long" when trying to run jscodeshift with a pattern match which returns 147 files. I am guessing this is because it passes all of the filenames on the command line. If I transform just a handful of files it works fine.
Can you let me know how I can resolve this issue please.
I am running this using Bash (MINGW64) on Windows 11. I can't use command prompt or PowerShell as they don't understand the globs like "**/*.spec.ts".
The text was updated successfully, but these errors were encountered:
darrenw-npi
changed the title
Override batch size (CHUNK_SIZE in Runner.js) or number of workers with command line argument
Error "The command line is too long" when trying to run jscodeshift with a pattern match which returns many files
Aug 10, 2024
This is a limitation of shells in Windows. You're right that the shell is expanding the glob and passing all the files on the command line. In bash/zsh/etc, you can run getconf ARG_MAX to get the maximum length of a command line. This returns 2097152 (2MB) on my Linux systems, but is often only 32000 (~32KB) in Windows bash shells. You can increase it using ulimit on Linux, but I'm not aware of a way to do that on Windows.
You could just pass a directory name and let jscodeshift traverse the files itself. That should work fine as long as your transform returns null if the file should not be transformed (this will keep the file as-is).
Alternatively, you could try using jscodeshift in WSL (Windows Subsystem for Linux), which should use the higher limits since it's a real(-ish) Linux environment rather than just some tools that have been ported to Windows.
I am getting "The command line is too long" when trying to run jscodeshift with a pattern match which returns 147 files. I am guessing this is because it passes all of the filenames on the command line. If I transform just a handful of files it works fine.
Can you let me know how I can resolve this issue please.
I am running this using Bash (MINGW64) on Windows 11. I can't use command prompt or PowerShell as they don't understand the globs like "**/*.spec.ts".
The text was updated successfully, but these errors were encountered: