

I mean, I would have normally expected the 1.0.1 version. To be honest, I wasn’t sure anymore what would be installed locally. I should probably update it, and NPM has a command for that. So, npm outdated just told me I have an old local version. That’s ok according to latest being the default one. Quick mention to the fact that if I run npm install with my package.json in an empty folder (aka without the 1.0.0 version already installed), it will still install 1.0.1 version. That’s not wrong but I can’t help myself finding that strange. And among all our versions (see the versions array from npm view), both 1.0.1 and 1.0.2 match this range, but since 1.0.2 is greater than 1.0.1, the wanted version is 1.0.2. After all, the package.json range is ^1.0.0 which means the greatest possible version without changing the first non-zero digit. How can it be greater than latest?Īctually, it’s all ok according to the NPM documentation. Wait a minute? I’m ok with current (the locally installed) being 1.0.0 and latest (matching the dist-tag) being 1.0.1 but wanted is supposed to be the best matching version I should install according to package.json. You should have something like: Package Current Wanted Latest Location Let’s check that by running npm outdated. NPM has a command to test if you have outdated versions locally installed. If you want to reproduce, just create an empty folder, then create a package.json inside it with the previous content and run npm install to force the install of an old version.ĭone? Cool, let’s move forward. Pretty classic, right? Now, for the purpose of the demo, let’s say we currently have the 1.0.0 version of test-npm-update locally installed. Meaning that if you run npm view test-npm-update, you will have something like: If you are wondering if real projects are using such tags, the answer is yes, the npm package is using latest and next tags for it’s weekly pre-release ( read more).Ĭurrently, latest points to 1.0.1 and canary to 1.0.2. But inside the dist-tags ( read more), we have two of them: the classic latest which refers to the latest stable release of the package and a custom one, named canary, indicating the last non-stable release of the package. This package has officially those 3 last versions: 1.0.0, 1.0.1 and 1.0.2.

Do not use npm update with any package which use custom dist-tags.
