Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"
}
like image 564
zok Avatar asked Apr 03 '17 10:04

zok


People also ask

What is the meaning of dependencies in package json?

The dependencies value is used to specify any other modules that a given module (represented by the package. json ) requires to work. When you run npm install from the root folder of a given module, it will install any modules listed in that dependencies object.

Does order of dependencies in package json matter?

json just lists dependencies in alphabetical order by default, so I don't think it matters. You usually won't be manually adding the dependencies to your file, rather you'll be instructing npm to save packages as dependencies when you install them.

What does Carrot mean in package json?

Using a caret (^) sign means that we can accept minor releases and patch releases, but not a major release when updating our package.

What's the difference between Tilde and caret in package json?

Using tilde ( ~ ) gives you bug fix releases and caret ( ^ ) gives you backwards-compatible new functionality as well. The problem is old versions usually don't receive bug fixes that much, so npm uses caret ( ^ ) as the default for --save .


2 Answers

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

like image 111
Michael Seltenreich Avatar answered Oct 06 '22 22:10

Michael Seltenreich


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

like image 23
chrisz Avatar answered Oct 06 '22 23:10

chrisz