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¶
- Node.js and npm installed.
- An active OrbitRepos instance. See Quick Start.
- Network access to
http://localhost:8080.
Create a Repository¶
- Log in to OrbitRepos.
- Navigate to Repositories > Create Repository.
- Select npm as the format.
- Name it
npm-internal(hosted) ornpm-all(group).
Push / Publish Artifacts¶
First, authenticate your npm CLI with OrbitRepos.
To publish a package, ensure your package.json includes the publishConfig or use the --registry flag:
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:
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.