nx: Jest & lint fails with the following ERROR: NX ERROR spawn E2BIG
Both my jest & lint fails with the following ERROR: NX ERROR spawn E2BIG
this is happening only on the CI pipeline. but the same works well in my local machine.
$ yarn affected:test
yarn run v1.22.5
$ ./node_modules/.bin/nx affected:test --base=origin/test-code --parallel --detectOpenHandles --forceExit
> NX ERROR spawn E2BIG
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 7
- Comments: 20 (3 by maintainers)
OK. After some debugging I was able to resolve the issue in our repo. I’ll try to explain the solution, hopefully its useful for others as well.
Also: Thank you for building NX! It’s an awesome tool and we love using it.
Our setup:
1. We use cypress, and specify cypress cache folder like:
2. We specify a cache object to reuse among jobs:
3. We have an ‘install’ job.
Note: cypress cache-folder amounts to almost 26.000 (!) files.
4. We have a ‘lint’ job.
Result:
The solution:
Cypress cache was adding ~26.000 files, which are all checked by the
affected
command, causing it to fail. Adding/cache
(our custom cypress cache location) to.gitignore
makes NX ignore all of these files.The
affected:lint
command now run smoothly again for us.Did a
git status
before the crash and found out that I had.pnpm-store
not added to .gitignore… fixed ^^Yep I am facing this is an issue also with freshly apps workspace and adding new node app using
@nrwl/node
generatorThis is likely a real issue. We’ll investigate it.
This is happening to me too, using GitLab’s Auto DevOps.
When running
/bin/herokuish buildpack test
on thetest
job, it fails with:nx
version:13.8.0
Downgrading to
13.4.4
fixes the issue.Thanks a lot, @Jeffrey-Zutt. that worked for me!