nodejs/node · error · Error

No dist-tags found for ${spec.name}

Error message

No dist-tags found for ${spec.name}

What it means

fetchTags() queries the registry's dist-tags endpoint and throws if the response is missing or empty (no keys). This typically means the package has no published versions yet, or the package does not exist on this registry.

Source

Thrown at deps/npm/lib/commands/dist-tag.js:200

        output.standard(`${name}:`)
        await this.list(npa(name), this.npm.flatOptions)
      } catch {
        // set the exitCode directly, but ignore the error since it will have already been logged by this.list()
        process.exitCode = 1
      }
    }
  }

  async fetchTags (spec, opts) {
    const data = await npmFetch.json(
      `/-/package/${spec.escapedName}/dist-tags`,
      { ...opts, 'prefer-online': true, spec }
    )
    if (data && typeof data === 'object') {
      delete data._etag
    }
    if (!data || !Object.keys(data).length) {
      throw new Error('No dist-tags found for ' + spec.name)
    }

    return data
  }
}

module.exports = DistTag

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Confirm the package exists and is published: `npm view <pkg>`
  2. Publish at least one version, which creates the initial `latest` tag
  3. Verify the registry URL and scope mapping in .npmrc
Defensive patterns

Strategy: try-catch

Validate before calling

async function packageHasTags(fetch, escapedName) {
  const data = await fetch.json(`/-/package/${escapedName}/dist-tags`, { 'prefer-online': true })
  return data && typeof data === 'object' && Object.keys(data).length > 0
}

Type guard

function hasDistTags(data) {
  return !!data && typeof data === 'object' && Object.keys(data).filter(k => k !== '_etag').length > 0
}

Try / catch

try {
  await operateOnTags(pkg)
} catch (e) {
  if (/No dist-tags found/.test(e.message)) { /* publish first or fix name */ }
  else throw e
}

Prevention

When it happens

Trigger: Running dist-tag ls/add/rm against a never-published package name; a private registry returning an empty 200; a typo'd package name that resolves to nothing.

Common situations: Bootstrapping a new package before first publish; scoped package name mismatch; mirror/registry that lacks the package.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/50649ce52a423380. Report an issue: GitHub.