question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parallel builds in gitlab fails with ERR_STREAM_NULL_VALUES

See original GitHub issue

Current Behavior

A parallel build (run-many) fails in gitlab-ci with:

TypeError [ERR_STREAM_NULL_VALUES]: May not write null values to stream

Steps to Reproduce

Seems to be an issue since NX 13.4.4

In our gitlab-ci

pnpm nx  run-many -- --all --target=build --prod --parallel --maxParallel=3
# Fails with npm as well
# and with the default parallel settings as well.
# only `parallel=1 fixes the problem

nx.json

  "tasksRunnerOptions": {
    "default": {
      "runner": "@nrwl/workspace/tasks-runners/default",
      "options": {
        "parallel": 3,
        "cacheDirectory": "./.cache/nx",
        "cacheableOperations": ["build", "lint", "test", "e2e", "build-storybook"],
        "useDeamonProcess": true
      }
    }
  },

Failure Logs

> nx run my-app:build:production 
node:internal/streams/writable:299
    throw new ERR_STREAM_NULL_VALUES();
    ^
TypeError [ERR_STREAM_NULL_VALUES]: May not write null values to stream
    at new NodeError (node:internal/errors:371:5)
    at _write (node:internal/streams/writable:299:11)
    at Socket.Writable.write (node:internal/streams/writable:334:10)
    at RunManyTerminalOutputLifeCycle.printTaskTerminalOutput (/builds/.../.../node_modules/.pnpm/@nrwl+workspace@13.4.4_451c6917a69c5c23f897ab677b8e83cf/node_modules/@nrwl/workspace/src/tasks-runner/run-many-terminal-output-life-cycle.js:87:24)
    at CompositeLifeCycle.printTaskTerminalOutput (/.../.../node_modules/.pnpm/@nrwl+workspace@13.4.4_451c6917a69c5c23f897ab677b8e83cf/node_modules/@nrwl/workspace/src/tasks-runner/life-cycle.js:66:19)
    at ChildProcess.<anonymous> (/.../.../node_modules/.pnpm/@nrwl+workspace@13.4.4_451c6917a69c5c23f897ab677b8e83cf/node_modules/@nrwl/workspace/src/tasks-runner/forked-process-task-runner.js:140:48)
    at ChildProcess.emit (node:events:394:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) {
  code: 'ERR_STREAM_NULL_VALUES'
}
 ELIFECYCLE  Command failed with exit code 1.

Environment

>  NX  Report complete - copy this into the issue template
  Node : 16.7.0
  OS   : linux x64
  pnpm : 6.26.1
  
  nx : undefined
  @nrwl/angular : 13.4.4
  @nrwl/cli : 13.4.4
  @nrwl/cypress : 13.4.4
  @nrwl/devkit : undefined
  @nrwl/eslint-plugin-nx : 13.4.4
  @nrwl/express : 13.4.4
  @nrwl/jest : 13.4.4
  @nrwl/linter : 13.4.4
  @nrwl/nest : undefined
  @nrwl/next : undefined
  @nrwl/node : 13.4.4
  @nrwl/nx-cloud : undefined
  @nrwl/react : undefined
  @nrwl/react-native : undefined
  @nrwl/schematics : undefined
  @nrwl/tao : 13.4.4
  @nrwl/web : undefined
  @nrwl/workspace : 13.4.4
  @nrwl/storybook : 13.4.5
  @nrwl/gatsby : undefined
  typescript : 4.5.4
  rxjs : 7.5.2
  ---------------------------------------
  Community plugins:
  	 @angular/animations: 13.1.2
  	 @angular/cdk: 13.1.2
  	 @angular/common: 13.1.2
  	 @angular/compiler: 13.1.2
  	 @angular/core: 13.1.2
  	 @angular/forms: 13.1.2
  	 @angular/material: 13.1.2
  	 @angular/material-date-fns-adapter: 13.1.2
  	 @angular/platform-browser: 13.1.2
  	 @angular/platform-browser-dynamic: 13.1.2
  	 @angular/router: 13.1.2
  	 @taiga-ui/core: 2.29.0
  	 apollo-angular: 2.6.0
  	 @angular-devkit/build-angular: 13.1.3
  	 @angular/cli: 13.1.3
  	 @angular/compiler-cli: 13.1.2
  	 @angular/language-service: 13.1.2
  	 @jscutlery/semver: 2.17.5
  	 @ngneat/aim: 2.0.0
  	 @nrwl/js: 13.4.4
  	 @storybook/angular: 6.4.13
  	 @testing-library/angular: 11.0.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:9

github_iconTop GitHub Comments

1reaction
ubergeoffcommented, Feb 1, 2022

Just an update - my “intermittent” issues (noted above) have gone away. Everything all good again - using:

        "@nrwl/cli": "13.5.3",
        "@nrwl/cypress": "13.5.3",
        "@nrwl/eslint-plugin-nx": "13.5.3",
        "@nrwl/jest": "13.5.3",
        "@nrwl/linter": "13.5.3",
        "@nrwl/tao": "13.5.3",

Also switch to:

        "jest": "27.4.7",
        "jest-canvas-mock": "^2.3.1",
        "jest-preset-angular": "~11.0.1",
1reaction
vsavkincommented, Jan 20, 2022

It looks like the file with the terminal output wasn’t written. I sent a PR showing the error: https://github.com/nrwl/nx/pull/8623

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running GitLab Multiple CI jobs always fail because they work ...
Our CI pipeline fails if multiple builds start at the same time. It is because multiple runners use the same git repository and...
Read more >
Optionally prevent running multiple pipelines in parallel - GitLab
If I push one commit quickly after another to my repository, pipeline starts for each of those commits. Because they start for each...
Read more >
Issue with cache and parallel jobs (#4036) - gitlab-runner
The problem we are facing is that install-dependencies runs, creates the cache. Then every job in build stage start. One of the jobs...
Read more >
Queue Builds so they don't run concurrent (#1469) - GitLab
I noticed that pushing to a repo triggers a new build, even when the ... /home/gitlab-runner/.gitconfig: File exists ERROR: Build failed: ...
Read more >
The basics of CI: How to run jobs sequentially, in parallel, or ...
The build fails as expected! OK, we now have automated tests here! GitLab CI will run our test script every time we push...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found