{"id":18739,"library":"registry-info","title":"registry-info","description":"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.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/kesla/registry-info","tags":["javascript"],"install":[{"cmd":"npm install registry-info","lang":"bash","label":"npm"},{"cmd":"yarn add registry-info","lang":"bash","label":"yarn"},{"cmd":"pnpm add registry-info","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Gets auth token for an npm registry","package":"registry-auth-token","optional":false},{"reason":"Gets the set npm registry URL","package":"registry-url","optional":false}],"imports":[{"note":"Package uses ESM default export. CommonJS require() will work if the package is transpiled, but the default import is the intended pattern.","wrong":"const registryInfo = require('registry-info')","symbol":"default","correct":"import registryInfo from 'registry-info'"},{"note":"The function is the default export, not a named export.","wrong":"import { registryInfo } from 'registry-info'","symbol":"registryInfo","correct":"import registryInfo from 'registry-info'"},{"note":"Call the function first, then destructure. The import is a function, not an object.","wrong":"const { registryUrl, authToken, authorization } = require('registry-info')()","symbol":"type usage","correct":"import registryInfo from 'registry-info'; const info = registryInfo();"}],"quickstart":{"code":"import registryInfo from 'registry-info';\n\n// Get info for default registry\nconst info = registryInfo();\nconsole.log(info);\n// { registryUrl: 'https://registry.npmjs.org/', authToken: undefined, authorization: undefined }\n\n// Get info for a scoped registry (e.g. @myco)\nconst scopedInfo = registryInfo('@myco');\nconsole.log(scopedInfo);\n// { registryUrl: 'https://registry.myco.com/', authToken: '...', authorization: 'Bearer ...' }","lang":"javascript","description":"Demonstrates default import and usage with and without scope."},"warnings":[{"fix":"Check if authToken or authorization exist before using in headers: const { authorization } = registryInfo(); if (authorization) { headers['Authorization'] = authorization; }","message":"The function returns authToken and authorization as undefined if no auth is found. You may need to check for undefined before using.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pin versions in package.json: \"registry-auth-token\": \"3.x\", \"registry-url\": \"5.x\"","message":"The 'registry-auth-token' dependency may have breaking changes in newer versions. Ensure compatible versions are used.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Set npm token: npm config set //registry.npmjs.org/:_authToken=YOUR_TOKEN","message":"The package expects the npm token to be set in .npmrc or environment variables. If not set, authToken will be undefined.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use `import registryInfo from 'registry-info'` instead of `import { registryInfo } from 'registry-info'`.","cause":"Using named import instead of default import.","error":"TypeError: registryInfo is not a function"},{"fix":"Run `npm install registry-info --save` and ensure the package is in your dependencies.","cause":"Package not installed in node_modules or path issue.","error":"Cannot find module 'registry-info'"},{"fix":"Use `const registryInfo = require('registry-info').default;` or better switch to ES imports.","cause":"Using CommonJS require without default assignment properly.","error":"registryInfo is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}