Registry / devops / registry-info

registry-info

JSON →
library1.0.0jsnpmunverified

Get npm registry information including URL, auth token, and authorization header from a given scope or default. Version 1.0.0. This is a small utility that combines registry-auth-token and registry-url to provide a unified API. It is useful for tooling that needs to interact with private npm registries. The package is mature and stable, with no recent updates. It supports both default registry and scoped registries. Alternative: directly using registry-auth-token and registry-url separately.

npm install registry-info
INSTALL
IMPORT
SIG · REGISTRY-INFO
R
registry-info
devopsjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import registryInfo from 'registry-info'
const registryInfo = require('registry-info')
Package uses ESM default export. CommonJS require() will work if the package is transpiled, but the default import is the intended pattern.
registryInfo
import registryInfo from 'registry-info'
import { registryInfo } from 'registry-info'
The function is the default export, not a named export.
type usage
import registryInfo from 'registry-info'; const info = registryInfo();
const { registryUrl, authToken, authorization } = require('registry-info')()
Call the function first, then destructure. The import is a function, not an object.

Demonstrates default import and usage with and without scope.

import registryInfo from 'registry-info'; // Get info for default registry const info = registryInfo(); console.log(info); // { registryUrl: 'https://registry.npmjs.org/', authToken: undefined, authorization: undefined } // Get info for a scoped registry (e.g. @myco) const scopedInfo = registryInfo('@myco'); console.log(scopedInfo); // { registryUrl: 'https://registry.myco.com/', authToken: '...', authorization: 'Bearer ...' }
Debug
Known issues
gotchaThe function returns authToken and authorization as undefined if no auth is found. You may need to check for undefined before using.
fix
Check if authToken or authorization exist before using in headers: const { authorization } = registryInfo(); if (authorization) { headers['Authorization'] = authorization; }
affects: >=1.0.0
deprecatedThe 'registry-auth-token' dependency may have breaking changes in newer versions. Ensure compatible versions are used.
fix
Pin versions in package.json: "registry-auth-token": "3.x", "registry-url": "5.x"
affects: >=1.0.0
gotchaThe package expects the npm token to be set in .npmrc or environment variables. If not set, authToken will be undefined.
fix
Set npm token: npm config set //registry.npmjs.org/:_authToken=YOUR_TOKEN
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: registryInfo is not a function
Using named import instead of default import.
fix
Use `import registryInfo from 'registry-info'` instead of `import { registryInfo } from 'registry-info'`.
Cannot find module 'registry-info'
Package not installed in node_modules or path issue.
fix
Run `npm install registry-info --save` and ensure the package is in your dependencies.
registryInfo is not defined
Using CommonJS require without default assignment properly.
fix
Use `const registryInfo = require('registry-info').default;` or better switch to ES imports.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
registry-auth-tokenrequiredGets auth token for an npm registry
registry-urlrequiredGets the set npm registry URL
Agent activity
4 hits · last 30 days
node
4
Resources
registry-info — npm install registry-info · libregistry