npm_install_helpers.ts view source
(repo: LocalRepo, ops: GitopsOperations, log?: Logger | undefined): Promise<void> Installs npm dependencies with cache healing on ETARGET errors.
Strategy:
1. First attempt: regular npm install
2. On ETARGET error (stale cache): npm cache clean --force then retry
3. On other errors: fail immediately
Why ETARGET errors occur: After publishing a package and waiting for NPM registry propagation, npm's local cache may still have stale "404" metadata. This healing strategy clears the cache to force fresh metadata fetch.
repo
- The repository to install dependencies for
type LocalRepo
ops
- Gitops operations (for dependency injection)
type GitopsOperations
log?
- Optional logger
type
Logger | undefinedoptional
returns
Promise<void> throws
Error- if install fails (with details about cache healing attempts)