nx: nx affected:lint -> Error: spawnSync /bin/sh ENOBUFS

why my nx affected query is failing after the angular 12 upgrades?

please see the errors below,

nx affected:lint
Lint projects affected by changes
Run command using --base=[SHA1] (affected by the committed, uncommitted and
untracked changes):
  --base  Base of the current branch (usually master)                   [string]
or using --base=[SHA1] --head=[SHA2] (affected by the committed changes):
  --base  Base of the current branch (usually master)                   [string]
  --head  Latest commit of the current branch (usually HEAD)            [string]
or using:
  --files        Change the way Nx is calculating the affected command by
                 providing directly changed files, list of files delimited by
                 commas                                                  [array]
  --uncommitted  Uncommitted changes                                   [boolean]
  --untracked    Untracked changes                                     [boolean]
Options:
  --help           Show help                                           [boolean]
  --version        Show version number                                 [boolean]
  --parallel       Parallelize the command (default: false)            [boolean]
  --maxParallel    Max number of parallel processes. This flag is ignored if the
                   parallel option is set to `false`. (default: 3)      [number]
  --all            All projects                                        [boolean]
  --exclude        Exclude certain projects from being processed
                                                           [array] [default: []]
  --runner         This is the name of the tasks runner configured in nx.json
                                                                        [string]
  --skip-nx-cache  Rerun the tasks even when the results are available in the
                   cache                              [boolean] [default: false]
  --configuration  This is the configuration to use when performing tasks on
                   projects                                             [string]
  --only-failed    Isolate projects which previously failed
                                                      [boolean] [default: false]
  --verbose        Print additional error stack trace on failure
<ref *1> Error: spawnSync /bin/sh ENOBUFS
    at Object.spawnSync (internal/child_process.js:1067:20)
    at spawnSync (child_process.js:602:24)
    at Object.execSync (child_process.js:647:15)
    at parseGitOutput (/builds/platform/ui/client/node_modules/@nrwl/workspace/src/command-line/shared.js:64:28)
    at getUntrackedFiles (/builds/platform/ui/client/node_modules/@nrwl/workspace/src/command-line/shared.js:43:12)
    at Object.parseFiles (/builds/platform/ui/client/node_modules/@nrwl/workspace/src/command-line/shared.js:33:20)
    at projectsToRun (/builds/platform/ui/client/node_modules/@nrwl/workspace/src/command-line/affected.js:97:108)
    at Object.<anonymous> (/builds/platform/ui/client/node_modules/@nrwl/workspace/src/command-line/affected.js:27:26)
    at Generator.next (<anonymous>)
    at fulfilled (/builds/platform/ui/client/node_modules/@nrwl/workspace/node_modules/tslib/tslib.js:114:62) {
  errno: -105,
  code: 'ENOBUFS',
  syscall: 'spawnSync /bin/sh',
  path: '/bin/sh',
  spawnargs: [ '-c', 'git ls-files --others --exclude-standard' ],
  error: [Circular *1],
  status: null,
  signal: 'SIGTERM',
  output: [
    null,
    <Buffer 2e 6e 70 6d 2f 73 65 6e 74 72 79 2d 63 6c 69 2f 33 66 63 35 30 36 2d 73 65 6e 74 72 79 2d 63 6c 69 2d 4c 69 6e 75 78 2d 78 38 36 2d 36 34 0a 63 61 63 ... 10244046 more bytes>,
    <Buffer >
  ],
  pid: 551,
  stdout: <Buffer 2e 6e 70 6d 2f 73 65 6e 74 72 79 2d 63 6c 69 2f 33 66 63 35 30 36 2d 73 65 6e 74 72 79 2d 63 6c 69 2d 4c 69 6e 75 78 2d 78 38 36 2d 36 34 0a 63 61 63 ... 10244046 more bytes>,
  stderr: <Buffer >
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Cleaning up file based variables
00:02
ERROR: Job failed: exit code 1x affected:lint
Lint projects affected by changes
Run command using --base=[SHA1] (affected by the committed, uncommitted and
untracked changes):
  --base  Base of the current branch (usually master)                   [string]
or using --base=[SHA1] --head=[SHA2] (affected by the committed changes):
  --base  Base of the current branch (usually master)                   [string]
  --head  Latest commit of the current branch (usually HEAD)            [string]
or using:
  --files        Change the way Nx is calculating the affected command by
                 providing directly changed files, list of files delimited by
                 commas                                                  [array]
  --uncommitted  Uncommitted changes                                   [boolean]
  --untracked    Untracked changes                                     [boolean]
Options:
  --help           Show help                                           [boolean]
  --version        Show version number                                 [boolean]
  --parallel       Parallelize the command (default: false)            [boolean]
  --maxParallel    Max number of parallel processes. This flag is ignored if the
                   parallel option is set to `false`. (default: 3)      [number]
  --all            All projects                                        [boolean]
  --exclude        Exclude certain projects from being processed
                                                           [array] [default: []]
  --runner         This is the name of the tasks runner configured in nx.json
                                                                        [string]
  --skip-nx-cache  Rerun the tasks even when the results are available in the
                   cache                              [boolean] [default: false]
  --configuration  This is the configuration to use when performing tasks on
                   projects                                             [string]
  --only-failed    Isolate projects which previously failed
                                                      [boolean] [default: false]
  --verbose        Print additional error stack trace on failure
<ref *1> Error: spawnSync /bin/sh ENOBUFS
    at Object.spawnSync (internal/child_process.js:1067:20)
    at spawnSync (child_process.js:602:24)
    at Object.execSync (child_process.js:647:15)
    at parseGitOutput (/builds/platform/ui/client/node_modules/@nrwl/workspace/src/command-line/shared.js:64:28)
    at getUntrackedFiles (/builds/platform/ui/client/node_modules/@nrwl/workspace/src/command-line/shared.js:43:12)
    at Object.parseFiles (/builds/platform/ui/client/node_modules/@nrwl/workspace/src/command-line/shared.js:33:20)
    at projectsToRun (/builds/platform/ui/client/node_modules/@nrwl/workspace/src/command-line/affected.js:97:108)
    at Object.<anonymous> (/builds/platform/ui/client/node_modules/@nrwl/workspace/src/command-line/affected.js:27:26)
    at Generator.next (<anonymous>)
    at fulfilled (/builds/platform/ui/client/node_modules/@nrwl/workspace/node_modules/tslib/tslib.js:114:62) {
  errno: -105,
  code: 'ENOBUFS',
  syscall: 'spawnSync /bin/sh',
  path: '/bin/sh',
  spawnargs: [ '-c', 'git ls-files --others --exclude-standard' ],
  error: [Circular *1],
  status: null,
  signal: 'SIGTERM',
  output: [
    null,
    <Buffer 2e 6e 70 6d 2f 73 65 6e 74 72 79 2d 63 6c 69 2f 33 66 63 35 30 36 2d 73 65 6e 74 72 79 2d 63 6c 69 2d 4c 69 6e 75 78 2d 78 38 36 2d 36 34 0a 63 61 63 ... 10244046 more bytes>,
    <Buffer >
  ],
  pid: 551,
  stdout: <Buffer 2e 6e 70 6d 2f 73 65 6e 74 72 79 2d 63 6c 69 2f 33 66 63 35 30 36 2d 73 65 6e 74 72 79 2d 63 6c 69 2d 4c 69 6e 75 78 2d 78 38 36 2d 36 34 0a 63 61 63 ... 10244046 more bytes>,
  stderr: <Buffer >
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Cleaning up file based variables
00:02
ERROR: Job failed: exit code 1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 18 (3 by maintainers)

Most upvoted comments

This issue has been automatically marked as stale because it hasn’t had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

Hi there,

just to give an update in case someone else comes across this issue as well.

Coincidently, I was able to fix this error by updating the cache and install in my gitlab-ci.yml.

Just to verify, I then logged the output of git ls-files --others --exclude-standard and there was no more node_modules in the listing. Reducing the output to below 10 Megabytes.

Below the setup,

.install: &install "[ ! -d node_modules ] && time CYPRESS_CACHE_FOLDER='./.cache/Cypress' yarn install --frozen-lockfile --prefer-offline --cache-folder .yarn || echo yarn.lock unchanged. Using cache."

cache: &use_yarn_cache
  key:
    files:
      - yarn.lock
  untracked: true
  policy: pull
  paths:
    - .yarn
    - node_modules
    - .cache/Cypress

I am not 100% sure what happened before but I assumed it was because the way my gitlab-ci.yml was configured. Eg. node_modules was not cached properly…

Anyway, I am still looking forward to getting an answer for my previous comment.

Cheers