node.jsnpmnrwl-nxpnpm

Nx operations hangs indefinitely


I'm trying to add Nx to my TS monorepo.

On first try, I installed it (pnpm i nx) but any run would hang on indefinitely. So I removed it, tried to reinstall it but now it hangs at postinstall

node_modules/.pnpm/nx@19.5.0_@swc+core@1.7.10/node_modules/nx: Running postinstall script

I tried other approach like pnpm dlx nx@latest init or even npx nx@latest init but it hangs at

 NX   🧐 Checking dependencies 

Also tried pnpm dlx create-nx-workspace from scratch but it hangs on the second step

Creating your workspace in test-nx

I tried multiple versions of Nx (from 19.5.0 to 19.5.7), multiple versions of PNPM and NPM. I cannot pinpoint what common operation hangs everytime. I removed node_modules, lock files, purge cache but nothing works and I'm out of solution.

Do you have any leads?

Env


Solution

  • Ran into this issue. It was due to a .gitignore file in one of the parent directories of my nx repo with the following contents:

    *
    

    nx post install stopped hanging after this .gitignore had been deleted, this might not be the cause of your issue, but you can try moving your project to a directory on a higher level with less parents to see if this issue still persists