badges/shields · error · NotFound
package not found
Error message
package not found
What it means
The React Native Directory badge throws NotFound 'package not found' when the directory dataset has no entry for the requested package name. The fetch already maps a 404 to the same message; a missing key in the response also triggers it. It means the library is not listed in the React Native Directory data.
Source
Thrown at services/react-native-directory/react-native-directory-platforms.service.js:85
return {
message:
supportedPlatforms.length > 0 ? supportedPlatforms.join(' | ') : 'none',
}
}
async handle({ scope, packageName }) {
const name = scope ? `${scope}/${packageName}` : packageName
const response = await this._requestJson({
schema,
url: `https://reactnative.directory/api/library?name=${encodeURIComponent(
name,
)}`,
httpErrors: { 404: 'package not found' },
})
const library = response[name]
if (!library) {
throw new NotFound({ prettyMessage: 'package not found' })
}
return this.constructor.render(library)
}
}
View on GitHub (pinned to 766fd8bc89)
Solutions
- Confirm the package is listed at reactnative.directory and use the exact npm name
- Submit/PR the library into the React Native Directory dataset if missing
- Check for typos or scope differences in the package name in the badge URL
Example fix
// before /badge/react-native-directory/react-native-fs (not listed) // after /badge/react-native-directory/react-native-fs → use listed name e.g. 'react-native-image-picker'
Defensive patterns
Strategy: validation
Validate before calling
const res = await fetch('https://reactnative.directory/api/libraries')
const dir = await res.json()
if (!(pkgName in dir)) throw new Error(`${pkgName} is not in the React Native Directory`) Type guard
function isInDirectory(dir, name) { return dir != null && Object.prototype.hasOwnProperty.call(dir, name) && typeof dir[name] === 'object' } Try / catch
try {
return await service.handle({ name: pkgName })
} catch (err) {
if (err instanceof NotFound && err.prettyMessage === 'package not found') {
return renderBadge({ label: 'rn-directory', message: 'not listed' })
}
throw err
} Prevention
- Confirm the package appears on reactnative.directory before adding the badge
- Use the exact npm package name including scope if listed
- Submit the library to the directory dataset if it is missing
When it happens
Trigger: Requesting a badge for a package not present in the React Native Directory dataset; a typo in the package name; a 404 from the upstream data source (mapped via httpErrors).
Common situations: New libraries not yet added to the directory; scoped/private packages that aren't listed; name mismatches (npm name vs directory slug).
Related errors
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/b4f099feed567ac5.
Report an issue: GitHub.