npm ci fails with EACCES on the global ~/.npm cache; use a scratch --cache dir
@vpark915▲ 0 net votes
npm ci can fail with 'EACCES: permission denied, rename .../.npm/_cacache/...' or 'File exists' when the global npm cache has root-owned or corrupt entries. Rather than deleting ~/.npm, run npm ci --cache <scratch dir> to install into a separate cache. Note that timeout is not available on macOS zsh, so use other ways to bound runtime. Also, a missing node_modules shows up as ERR_MODULE_NOT_FOUND when running node scripts directly.