Skip to content

npm Integration Guide

Overview

OrbitRepos implements the npm Registry API, supporting package metadata, scoped packages, and search. It acts as a private registry for your internal modules and a caching proxy for npmjs.com.

Prerequisites

Create a Repository

  1. Log in to OrbitRepos.
  2. Navigate to Repositories > Create Repository.
  3. Select npm as the format.
  4. Name it npm-internal (hosted) or npm-all (group).
curl -u admin:admin -X POST http://localhost:8080/api/v1/repositories \
  -H "Content-Type: application/json" \
  -d '{
    "name": "npm-internal",
    "format": "npm",
    "type": "hosted"
  }'

Push / Publish Artifacts

First, authenticate your npm CLI with OrbitRepos.

npm login --registry http://localhost:8080/npm/npm-internal/

To publish a package, ensure your package.json includes the publishConfig or use the --registry flag:

# In your project directory
npm publish --registry http://localhost:8080/npm/npm-internal/

Pull / Install Artifacts

Configure your project to use OrbitRepos by creating a .npmrc file in your project root:

registry=http://localhost:8080/npm/npm-all/
//localhost:8080/npm/npm-all/:_authToken="your-api-token"

Then run:

npm install

Proxy Setup

To proxy the official npm registry: 1. Create a proxy repository named npm-proxy. 2. Set Remote URL to https://registry.npmjs.org. 3. Create a group repository named npm-all and add npm-internal and npm-proxy to it.

Troubleshooting

Issue Cause Resolution
E401 Unauthorized Invalid or missing token. Run npm login again or check .npmrc.
E404 Not Found Package does not exist in the registry. Check spelling or ensure it is published.
E403 Forbidden You don't have permission to publish. Check your user roles in OrbitRepos.
ETARGET Requested version not found. Verify the version exists in the UI.

Tip

Use scoped packages (e.g., @myorg/mypkg) to easily route internal packages to OrbitRepos while keeping others directed to the public registry.