Environment:A5c ai Babysitter npm CLI
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Release_Management |
| Last Updated | 2026-10-23 00:00 GMT |
Overview
npm CLI environment for package publication, dist-tag promotion, and published release verification across the Babysitter monorepo.
Description
This environment provides the npm CLI required for publishing packages to the npm registry, managing dist-tags (candidate, latest, stable), and verifying that published packages are consumable. The release pipeline uses `npm publish` with candidate dist-tags, `npm dist-tag` for channel promotion, and `npm view` / `npm ls` for consumer validation. Registry access is authenticated via npm tokens configured in `.npmrc` or CI environment.
Usage
Use this environment for package publication (publish_package_from_tag), channel promotion (release_channel_promotion), published release verification (verify_published_release), and atlas plugin compilation that bundles npm packages. It is the mandatory prerequisite for all release pipeline operations that interact with the npm registry.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux / macOS | CI runners; Windows not tested |
| Hardware | 1 CPU core, 2GB RAM | Sufficient for publish operations |
| Disk | 5GB SSD | For package builds and tarballs |
| Network | Internet access to npm registry | Required for publish, view, and dist-tag operations |
Dependencies
System Packages
- `node` >= 20.0.0 (npm is bundled)
- `npm` >= 10.0.0
npm Configuration
- `.npmrc` with registry authentication token
- `NODE_AUTH_TOKEN` environment variable (for CI publish)
Credentials
The following credentials are required for registry operations:
- `NODE_AUTH_TOKEN`: npm authentication token for package publication (publish access)
- `NPM_TOKEN`: Alternative npm token variable (read access for verification)
- Registry URL configured in `.npmrc` or `npm config`
Quick Install
# npm is bundled with Node.js 20+
node --version # verify >= 20
npm --version # verify >= 10
# Configure registry authentication
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > .npmrc
Code Evidence
npm CLI usage in release promotion from `scripts/release-promotion.cjs:189-213`:
promote: (options) => {
const releaseVersion = required(options, 'version');
const distTag = required(options, 'dist-tag');
const npmBin = typeof options.npm === 'string' ? options.npm : 'npm';
const result = promoteChannelTags({ repoRoot, releaseVersion, distTag, evidence, npmBin });
process.stdout.write(
`Promoted ${result.promoted.length} public package(s) to ${distTag}=${releaseVersion}...\n`
);
},
npm not-found pattern from `scripts/publish-package-from-tag.mjs:22`:
const NPM_NOT_FOUND_PATTERN = /\bE404\b|404\s+Not\s+Found/i;
Consumer validation using `npm ls` from `scripts/release-promotion.cjs:225-229`:
const npmBin = typeof options.npm === 'string' ? options.npm : 'npm';
const args = ['ls', '--depth=0', '--json'];
if (options.global) args.push('--global');
const result = spawnSync(npmBin, args, { cwd: repoRoot, encoding: 'utf8' });
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `npm error code E404` | Package version not found on registry | Verify the version was published; check dist-tag configuration |
| `npm error code E403` | Insufficient publish permissions | Verify `NODE_AUTH_TOKEN` has publish access to the package scope |
| `npm error code E409` | Version already exists | Version was already published; use a new version or unpublish within 72h |
| `ECONNRESET` | Network error during registry query | Retry; distinguish from E404 (absence) vs network failure |
Compatibility Notes
- npm < 10: Error message format differs (`npm ERR! code E404` vs `npm error code E404`). The not-found pattern handles both.
- pnpm/yarn: Not directly supported; the `--npm` flag allows specifying an alternative binary but behavior is untested.
- Private registry: Configure registry URL in `.npmrc`; the pipeline supports scoped packages.