[x] I have searched for similiar issues before filing this issue.
node version: 12.10.0
I have the following scoped package published on npm: https://www.npmjs.com/package/@benface/tailwindcss-config
You can see that the latest stable version, 1.2.9, was released 5 months ago, and that the latest pre-release version, 2.0.0-beta.5, was released 4 days ago.
I have a project that has it listed as a dependency in package.json, like this:
"dependencies": {
"@benface/tailwindcss-config": "1.1.0"
},
So ncu --newest should tell me that it is outdated, and that the newest version is 2.0.0-beta.5, right? But instead, this happens:
All dependencies match the newest package versions :)
Try using the —pre=1 switch ... I.e...
ncu —pre=1 -u
@benface That's odd, as --newest seems to work as desired for me:
Package.json:
{
"dependencies": {
"@benface/tailwindcss-config": "1.1.0"
}
}
Output:
$ ncu
@benface/tailwindcss-config 1.1.0 → 1.2.9
$ ncu --newest
@benface/tailwindcss-config 1.1.0 → 2.0.0-beta.5
@raineorshine ... I’ve found the behaviour with pre-release versions (-beta.X, -rc.Xetc) has been “erratic” for a few months ... sometimes —newest picks them up by itself, sometimes —pre=1 picks them up by itself, sometimes you need a combination of them both and sometimes nothing works.
I seem to a recall there was some problem with alodash function being used to prune an array of candidates ... whether it was a bug or a feature I’m not sure.
For our own purposes (we have around a bunch of packages that are under development where there are constant -rc.X releases being published) we’ve taken ncu out of the toolchain and rolled our own (much less feature rich) solution and only use ncu “interactivity”.
Once we’re passed the next major release of our project then one of our team will probably dig into the ncu code of the problem still exists.
@goulash1971 Thanks for the suggestion but --pre=1 doesn't work either.
@raineorshine Really weird. I tried again in a brand new project and I can reproduce it just fine (although on the same machine):
benface:new-project benface$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
package name: (new-project)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /Users/benface/Desktop/new-project/package.json:
{
"name": "new-project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Is this OK? (yes)
benface:new-project benface$ npm install @benface/tailwindcss-config@^1.1.0
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
+ @benface/[email protected]
added 17 packages from 6 contributors and audited 28 packages in 2.817s
found 0 vulnerabilities
benface:new-project benface$ ncu -n
Checking /Users/benface/Desktop/new-project/package.json
[====================] 1/1 100%
All dependencies match the newest package versions :)
@benface Was able to reproduce and pinned it down to cache. Fix is in #578, you could try npx npm-check-updates@stoically/npm-check-updates#disable-cacache --newest to see if it works for you.
@goulash1971 This probably also fixes it for you, since a cache would explain random behavior.
@stoically Yes it fixes it for me, thank you!
BTW that's so cool, I didn't know npx could do that. :)
@stoically thanks for doing this will test that out ... hadn't considered a caching problem but certainly would explain things, especially since it happens as part of our CI pipelines
Most helpful comment
@benface Was able to reproduce and pinned it down to cache. Fix is in #578, you could try
npx npm-check-updates@stoically/npm-check-updates#disable-cacache --newestto see if it works for you.@goulash1971 This probably also fixes it for you, since a cache would explain random behavior.