Using affected:build in CI yields spawnSync error
See original GitHub issueExpected Behavior
When running affected:build in CI, Nx should build the affected apps.
Current Behavior
The affected:build command fails before running any tests.
Failure Information (for bugs)
Build output:
$ ./node_modules/.bin/nx affected:build --base=origin/master --prod --build-optimizer
> NX ERROR There was a critical error when running your command
spawnSync /bin/sh ENOBUFS
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: Job failed: command terminated with exit code 1
Steps to Reproduce
We are using FROM node:12
as our base docker image in CI.
Context
Please provide any relevant information about your setup:
- version of Nx used: 8.5.1
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Handle Node.js spawnSync errors - Stack Overflow
In Node documentation regarding options.stdio it says. By default, the child's stdin, stdout, and stderr are redirected to corresponding subprocess.stdin, ...
Read more >Child process | Node.js v19.3.0 Documentation
Node.js lexicographically sorts the env keys and uses the first one that ... spawnSync() function provides equivalent functionality in a synchronous manner ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi,
today I ran into the same problem using
nx affected
in my Jenkins pipeline:Error: spawnSync /bin/sh ENOBUFS
.After some investigation, I saw that
git ls-files --others --exclude-standard
produced an output with a size of 11 MB because of Yarn’s.cache
directory inside the workspace. Well, that’s definitely above rdp10’s PR.After some thought, I found a very simple solution:
git ls-files --others --exclude-standard
ignores everything that is in your.gitignore
file. So, to get rid of this error, it’s sufficient to put.cache
inside your.gitignore
file.@vsavkin: Would perhaps be worth a hint in the documentation. 😉
Hope that helps.
Best wishes, Michael
Had the same issue today in my gitlab ci pipeline. Turned out my
.gitignore
file was ignored by my.dockerignore
file, which madegit ls-files --others --exclude-standard
return the whole contents of node_modules… Removing.gitignore
from the.dockerignore
file solved it.Thanks for pointing me in the right direction @MichaelKaaden.