Postinstall script hangs on >21.0.3
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
- Add nx to repo with latest version
- 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
Happens on Windows too https://github.com/nrwl/nx/issues/33018
I am also expriencing this on my windows machine. Strangely on my mac it runs smoothly.
FYI, downgrading to [email protected] fixes the issue
I am experiencing the same problem. On Windows and on Linux Runners.
Windows Node Version: 22.13.0, NX Version: 21.6.5.
I have the same problem with node 22.15.0
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 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
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.