# latest-version

> Get the latest version of an npm package

Latest version **9.0.0** (published 2024-02-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install latest-version
pnpm add latest-version
yarn add latest-version
bun add latest-version
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 9.0.0 |
| Published | 2024-02-27 |
| First published | 2014-04-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18 |
| Dependencies | 1 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 177 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | latest, version, npm, pkg, package, package.json, current, module |

## Links

- npm: https://www.npmjs.com/package/latest-version
- Repository: https://github.com/sindresorhus/latest-version
- Homepage: https://github.com/sindresorhus/latest-version#readme
- Issues: https://github.com/sindresorhus/latest-version/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/latest-version

## Dependencies (1)

- [package-json](https://npm.io/package/package-json.md) ^10.0.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 9.0.0 (latest) — 2024-02-27
- 8.0.0 — 2024-01-23
- 7.0.0 — 2022-06-23
- 6.0.0 — 2021-07-22
- 5.1.0 — 2019-04-04
- 5.0.0 — 2019-03-12
- 4.0.0 — 2018-06-09
- 3.1.0 — 2017-03-26
- 3.0.0 — 2017-02-13
- 2.0.0 — 2015-10-09
- 1.0.1 — 2015-06-18
- 1.0.0 — 2014-08-14
- 0.2.0 — 2014-06-15
- 0.1.2 — 2014-05-11
- 0.1.1 — 2014-04-21
- … 1 more at https://npm.io/package/latest-version/versions

## README

# latest-version

> Get the latest version of an npm package

Fetches the version directly from the registry instead of depending on the massive [npm](https://github.com/npm/npm/blob/8b5e7b6ae5b4cd2d7d62eaf93b1428638b387072/package.json#L37-L85) module like the [latest](https://github.com/bahamas10/node-latest) module does.

## Install

```sh
npm install latest-version
```

## Usage

```js
import latestVersion from 'latest-version';

console.log(await latestVersion('ava'));
//=> '6.1.1'

console.log(await latestVersion('@sindresorhus/df'));
//=> '4.0.0'

// Also works with semver ranges and dist-tags
console.log(await latestVersion('npm', {version: 'latest-5'}));
//=> '5.10.0'
```

This package exposes the [`version`](https://github.com/sindresorhus/package-json#version), [`registryUrl`](https://github.com/sindresorhus/package-json#registryurl), and [`omitDeprecated`](https://github.com/sindresorhus/package-json#omitdeprecated) options from [`package-json`](https://github.com/sindresorhus/package-json#options), as well as the [`PackageNotFoundError`](https://github.com/sindresorhus/package-json#packagenotfounderror) and [`VersionNotFoundError`](https://github.com/sindresorhus/package-json#versionnotfounderror) errors.

## Related

- [latest-version-cli](https://github.com/sindresorhus/latest-version-cli) - CLI for this module
- [package-json](https://github.com/sindresorhus/package-json) - Get the package.json of a package from the npm registry

---
_Source: https://npm.io/package/latest-version · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
