I believe Apple has implemented a restriction on the number of external connections.
For problem with npm ci try adding: npm config set maxsockets 3
or less then 3 . By default it's "15" See docs: https://docs.npmjs.com/cli/v9/using-npm/config#maxsockets
In the end should be:
npm config set maxsockets 3
npm ci