nx icon indicating copy to clipboard operation
nx copied to clipboard

Postinstall script hangs on >21.0.3

Open reediculous456 opened this issue 1 week ago โ€ข 2 comments

Current Behavior

Running npm install hangs because of the nx postinstall (using npm install --versbose to figure out what causes it to get stuck)

Expected Behavior

npm install completes successfully

GitHub Repo

No response

Steps to Reproduce

  1. Add nx to repo with latest version
  2. try to run npm install

Nx Report

> nx report

sh: line 1: nx: command not found

Failure Logs

npm info run [email protected] postinstall node_modules/nx node ./bin/post-install || exit 0

Never finishes

Package Manager Version

npm 11.6.4, node 22.21.1

Operating System

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

Additional Information

Running on AlmaLinux 9.7 with x86_64 CPU. The same package-lock file works on my M series Mac, but not on the server. Seems similar to https://github.com/nrwl/nx/issues/31300

reediculous456 avatar Dec 08 '25 18:12 reediculous456

Happens on Windows too https://github.com/nrwl/nx/issues/33018

Akxe avatar Dec 09 '25 00:12 Akxe

I am also expriencing this on my windows machine. Strangely on my mac it runs smoothly.

vajkayrene avatar Dec 09 '25 11:12 vajkayrene

FYI, downgrading to [email protected] fixes the issue

fcamblor avatar Dec 11 '25 10:12 fcamblor

I am experiencing the same problem. On Windows and on Linux Runners.

Windows Node Version: 22.13.0, NX Version: 21.6.5.

IJustDev avatar Dec 11 '25 13:12 IJustDev

I have the same problem with node 22.15.0

Akxe avatar Dec 11 '25 13:12 Akxe

Okay so appearently following the blog post https://timdeschryver.dev/blog/resolving-a-failing-nx-post-install the issue was a mismatched nx devkit version for one of the packages.

We installed various packages that need @nx/devkit. One of them was @nx/s3-cache.

All of them excepft for @nx/s3-cache had the version 21.6.5 installed. @nx/s3-cache was at version 3.0.1, which requires @nx/devkit 21.5.1.

@nx/[email protected] uses 21.5.1 too. @nx/[email protected] uses @nx/devkit>=22.

So the only thing that fixed all of this headache was to downgrade all the nx packages to @21.5.1. With this change, everything is working fine again.

IJustDev avatar Dec 11 '25 14:12 IJustDev

@IJustDev Nice catch. Not bulletproof thought:

๐Ÿฆ„  npm ls nx
โ”œโ”€โ”ฌ @nx/[email protected]
โ”‚ โ””โ”€โ”ฌ @nx/[email protected]
โ”‚   โ””โ”€โ”€ [email protected] deduped
โ”œโ”€โ”ฌ @nx/[email protected]
โ”‚ โ””โ”€โ”€ [email protected] deduped
โ””โ”€โ”€ [email protected]

And I am still getting the error, even on a fresh Window install

Akxe avatar Dec 11 '25 14:12 Akxe

I'm going to close this out as a duplicate of https://github.com/nrwl/nx/issues/31300, note we are looking into various reasons this may be occurring.

AgentEnder avatar Dec 15 '25 22:12 AgentEnder