{"id":27945,"library":"maxmind-asn","title":"maxmind-asn","description":"Provides pre-packaged MaxMind GeoLite2 ASN database for use with node-maxmind. This package distributes the ASN database (autonomous system number and organization) for IP geolocation lookups, released weekly. Version 1.0.3-20191224 is the latest. It simplifies integrating MaxMind's free GeoLite2 databases into Node.js applications by avoiding manual downloads. Compared to alternatives like geoip-lite, it offers more accurate and up-to-date data via MaxMind's official databases. Note the licensing changes effective December 30, 2019, requiring a free MaxMind account for database access.","status":"active","version":"1.0.3-20191224","language":"javascript","source_language":"en","source_url":"https://github.com/pi0/maxmind-databases","tags":["javascript","geoip","maxmind","geolite","geolite2","city"],"install":[{"cmd":"npm install maxmind-asn","lang":"bash","label":"npm"},{"cmd":"yarn add maxmind-asn","lang":"bash","label":"yarn"},{"cmd":"pnpm add maxmind-asn","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Do not import maxmind-asn directly; it is a packaged database file for use with 'maxmind' package.","wrong":"import asn from 'maxmind-asn';","symbol":"maxmind-asn","correct":"import maxmind from 'maxmind'; const asn = maxmind.openSync(require('maxmind-asn'));"},{"note":"node-maxmind supports both ESM and CommonJS. The package is ESM-first, but CommonJS require works as well.","wrong":"const maxmind = require('maxmind');","symbol":"maxmind","correct":"import maxmind from 'maxmind';"},{"note":"The database must be opened via maxmind.openSync() before calling .get()","wrong":"const result = require('maxmind-asn').get('8.8.8.8');","symbol":"lookupASN.get()","correct":"const lookup = maxmind.openSync(require('maxmind-asn')); const result = lookup.get('8.8.8.8');"}],"quickstart":{"code":"import maxmind from 'maxmind';\nimport asnDb from 'maxmind-asn';\n\nconst lookup = maxmind.openSync(asnDb);\nconst result = lookup.get('8.8.8.8');\n\nconsole.log(result);\n// {\n//   autonomous_system_number: 15169,\n//   autonomous_system_organization: 'Google LLC'\n// }","lang":"typescript","description":"Opens the bundled MaxMind ASN database synchronously and looks up an IP address."},"warnings":[{"fix":"Check MaxMind blog for updates; consider using 'maxmind' package with manual database download and API key.","message":"License changes effective December 30, 2019 require a free MaxMind account and API key to download GeoLite2 databases, but as of v1.0.3-20191224, the npm package still bundles the database. Future updates may require manual download or API key.","severity":"breaking","affected_versions":">=1.0.3"},{"fix":"Use node-maxmind's new database download features instead of separate npm packages.","message":"The maxmind-databases packages (maxmind-asn, maxmind-country, maxmind-city) may be deprecated in favor of a more integrated approach with node-maxmind's built-in database download.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Periodically update the package to get the latest database, or use MaxMind's direct download.","message":"The database is bundled and installed in node_modules; it may become stale. For up-to-date data, users should consider downloading the latest database manually.","severity":"gotcha","affected_versions":"*"},{"fix":"Evaluate if bundling a full database is acceptable for your use case.","message":"The package size is ~5 MB uncompressed; it may not be suitable for environments with strict size limits.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run 'npm install maxmind-asn' and ensure you import using require('maxmind-asn') (CommonJS) or import 'maxmind-asn' (ESM).","cause":"Missing import of the package; user may have forgotten to install it or used wrong import syntax.","error":"Error: Cannot find module 'maxmind-asn'"},{"fix":"Install the latest node-maxmind version: 'npm install maxmind@latest'","cause":"Using a version of node-maxmind that does not export openSync (e.g., very old version).","error":"TypeError: maxmind.openSync is not a function"},{"fix":"Reinstall the package: 'npm install maxmind-asn'","cause":"The packaged file structure may be incorrect or the package was corrupted.","error":"Error: ENOTDIR: not a directory, open '/path/to/node_modules/maxmind-asn/index.mmdb'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}