简体   繁体   中英

What exactly does "next" mean in package.json dependencies?

What exactly does next mean in package.json dependencies?

"dependencies": {
  "react": "^15.4.2",
  "react-dom": "^15.4.2",
  "react-router-dom": "next"
}

The next tag is used by some projects to identify the upcoming version.By default, other than latest, no tag has any special significance to npm itself.

NPM Documentation

Specifically, and according to the documentation I found this helpful:

By default, the latest tag is used by npm to identify the current version of a package, and npm install (without any @ or @ specifier) installs the latest tag. Typically, projects only use the "latest" tag for stable release versions, and use other tags for unstable versions such as prereleases .

The next tag is used by some projects to identify the upcoming version.

By default, other than latest, no tag has any special significance to npm itself.

So, for instance, I had some issues related to npm itself generating npm ERR! Error: EACCES: permission denied errors on package installations, that I first corrected by reverting to an earlier version of npm (from 5.4.0):

npm install -g npm@5.3.0

But npm is also one of those packages that does use the "next" tag in their distribution, so to take advantage of that in the newest but not officially "stable version", you could also run:

npm install -g npm@next

Which installed 5.5.1

Running: npm show npm versions --json shows the following version history to give an idea what exactly was installed: [ ... "5.3.0", "5.4.0", "5.4.1", "5.4.2", "5.5.0", "5.5.1" ]

This answer is an attempt to state the purpose of @next more simply. The language in the docs and in other answers appears overly complex.

Using next as the version number will allow a pre-release version if the project has one available. It will otherwise allow the latest stable version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM