nx icon indicating copy to clipboard operation
nx copied to clipboard

Increase NX_SOCKET_DIR limit

Open wereHamster opened this issue 1 year ago • 3 comments

Current Behavior

$ nx dev some-project

 NX   Attempted to open socket that exceeds the maximum socket length.


Set NX_SOCKET_DIR to a shorter path (e.g. /tmp/nx-tmp) to avoid this issue.
Pass --verbose to see the stacktrace.

My TMPDIR is /var/folders/7s/dlmpd6y94313nwn6q4mtwmf00000gn/T/nix-shell.exKnBn and workspace folder /Users/<username>/src/<workspace> (length 27). Together close to the Nx-imposed limit of 95 characters.

I have to manually set NX_SOCKET_DIR to a shorter path (eg. /tmp), then I can start using Nx.

Expected Behavior

Nx works in 'standard' situations with default TMPDIR and a workspace in a reasonable location.

GitHub Repo

No response

Steps to Reproduce

Be on MacOS, set TMPDIR to /var/folders/7s/dlmpd6y94313nwn6q4mtwmf00000gn/T/ (or similarly long path), have the workspace in a folder whose path length is >40 characters, try to run any Nx task.

Nx Report

Node           : 20.15.1
OS             : darwin-arm64
Native Target  : aarch64-macos
pnpm           : 9.6.0

nx                 : 19.6.4
@nx/js             : 19.6.4
@nx/linter         : 19.6.4
@nx/eslint         : 19.6.4
@nx/workspace      : 19.6.4
@nx/devkit         : 19.6.4
@nx/esbuild        : 19.6.4
@nx/eslint-plugin  : 19.6.4
@nx/next           : 19.6.4
@nx/react          : 19.6.4
@nrwl/tao          : 19.6.4
@nx/web            : 19.6.4
@nx/webpack        : 19.6.4
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/next/plugin

Failure Logs

No response

Package Manager Version

No response

Operating System

  • [X] macOS
  • [ ] Linux
  • [ ] Windows
  • [ ] Other (Please specify)

Additional Information

Relevant code which throws the error: https://github.com/nrwl/nx/blob/18e5535940a0aff86dc845f3714b07b94a0db8d8/packages/nx/src/daemon/socket-utils.ts#L39-L51

This seems to be a new behavior, it only started being an issue recently (maybe after my 19.6.3 -> 19.6.4 upgrade, but I'm not 100% certain).

wereHamster avatar Sep 01 '24 11:09 wereHamster