nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.36k stars 2.33k forks source link

Postinstall script hangs when installing with pnpm #28148

Open keriati opened 4 days ago

keriati commented 4 days ago

Current Behavior

Postinstall script hangs when installing with pnpm on MacOS.

Expected Behavior

Postinstall script finishes.

GitHub Repo

No response

Steps to Reproduce

  1. run npm i with nx in package.json

Nx Report

nx report seems not to work

Failure Logs

❯ NX_VERBOSE_LOGGING=true NX_PERF_LOGGING=true NX_CACHE_PROJECT_GRAPH=false NX_NATIVE_LOGGING=nx node node_modules/nx/bin/post-install.js
TRACE nx::native::workspace::context: workspace_root="/Users/<username>/Projects/<project>"
TRACE nx::native::workspace::context: Initially locking files
TRACE nx::native::workspace::context: Gathering files in /Users/<username>/Projects/<project>
TRACE nx::native::glob: converted globs globs=["**/node_modules", "**/.git", "**/.nx/cache", "**/.nx/workspace-data", "**/.yarn/cache"] result=["**/node_modules", "**/.git", "**/.nx/cache", "**/.nx/workspace-data", "**/.yarn/cache"]
TRACE nx::native::walker: walking directory="/Users/<username>/Projects/<project>"
TRACE nx::native::walker: walked in 1.607167ms
TRACE nx::native::workspace::files_hashing: Found 0 files
TRACE nx::native::workspace::files_hashing: hashing workspace files in parallel
TRACE nx::native::workspace::files_hashing: hashed workspace files in 131.916µs
TRACE nx::native::workspace::context: hashed and sorted files in 1.923416ms
TRACE nx::native::workspace::files_archive: could not write files archive: No such file or directory (os error 2)
TRACE nx::native::workspace::context: files retrieved files_len=0

Package Manager Version

pnpm 9.3.0

Operating System

Additional Information

os: MacOS 15.0 and MacOS 14 node: v20.17.0 pnpm 9.3.0 nx: 19.8.0

Did try node 22, few pnpm versions, always the same result.

Exact same issue is described in this closed ticket: https://github.com/nrwl/nx/issues/27056

gitLinda commented 4 days ago

I have the exact same problem on windows. OS: Windows 11 Pro node: 18.18.2 pnpm: 8.10.0 nx: 19.8.0

keriati commented 4 days ago

Based on comments from previous ticket, i can reproduce the error with this command:

NX_VERBOSE_LOGGING=true NX_PERF_LOGGING=true NX_CACHE_PROJECT_GRAPH=false NX_NATIVE_LOGGING=nx node node_modules/nx/bin/post-install.js

I also get this output:


TRACE nx::native::workspace::context: workspace_root="/Users/<user>/Projects/<project>"
TRACE nx::native::workspace::context: Initially locking files
TRACE nx::native::workspace::files_archive: read archive in 411.459µs
TRACE nx::native::workspace::context: Gathering files in /Users/<user>/Projects/<project>
TRACE nx::native::glob: converted globs globs=["**/node_modules", "**/.git", "**/.nx/cache", "**/.nx/workspace-data", "**/.yarn/cache"] result=["**/node_modules", "**/.git", "**/.nx/cache", "**/.nx/workspace-data", "**/.yarn/cache"]
TRACE nx::native::walker: walking directory="/Users/<user>/Projects/<project>"
TRACE nx::native::walker: walked in 2.835792ms
TRACE nx::native::workspace::files_hashing: filtered archive files in 667ns
TRACE nx::native::workspace::files_hashing: no additional files to hash
TRACE nx::native::workspace::context: hashed and sorted files in 2.993833ms
TRACE nx::native::workspace::files_archive: write archive in 263.834µs
TRACE nx::native::workspace::context: files retrieved files_len=0
Time for 'Load Nx Plugin: /Users/<user>/Projects/<project>/node_modules/.pnpm/nx@19.8.0_@swc-node+register@1.6.7_@swc+core@1.3.83_@swc+helpers@0.5.12__@swc+types@0.1.12_ty_smkezf5ssdaier6uufeirwp64i/node_modules/nx/src/plugins/project-json/build-nodes/project-json' 0.29895799999999895
Time for 'Load Nx Plugin: /Users/<user>/Projects/<project>/node_modules/.pnpm/nx@19.8.0_@swc-node+register@1.6.7_@swc+core@1.3.83_@swc+helpers@0.5.12__@swc+types@0.1.12_ty_smkezf5ssdaier6uufeirwp64i/node_modules/nx/src/plugins/package-json' 0.3219169999999991
TRACE nx::native::workspace::context: waiting for files to be available
Time for 'Load Nx Plugin: /Users/<user>/Projects/<project>/node_modules/.pnpm/nx@19.8.0_@swc-node+register@1.6.7_@swc+core@1.3.83_@swc+helpers@0.5.12__@swc+types@0.1.12_ty_smkezf5ssdaier6uufeirwp64i/node_modules/nx/src/plugins/js' 9.766417000000004
keriati commented 4 days ago

Compared to machines where this works, my instance is getting stuck on this line:

TRACE nx::native::workspace::context: waiting for files to be available

while on other machines this is instantly followed by:

TRACE nx::native::workspace::context: files are available

This above line never shows up for me, just keeps waiting forever...