'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"
}


Solution 1:[1]

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

Solution 2:[2]

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 [email protected]

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 --jsonshows 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" ]

Solution 3:[3]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Michael Seltenreich
Solution 2 chrisz
Solution 3 Kay V