You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code then applies the "range" to the releases it pulled, except it's limited to the last 100 because the code only pulls the latest 100 releases, because requesting more would require multiple calls for multiple pages.
As a temporary fix for my local copy, I modified the if statement to exclude versions that are just a basic semver and not a range from going through range matching.
Maybe an acceptable solution? seems like there's a few other spots in the code that could use that.
Probably better long-term solution is to cache the versions, and only check for new versions if cache is older than X time, and retrieve multiple pages of releases until you hit a version in the cache already. That however is much more complicated to implement, and the above got us rolling again.
The text was updated successfully, but these errors were encountered:
So this is still an issue. Part of the reason we use nodist is to lock the version we use for some projects. It's frustrating when we go to load up an old version and it fails. There's now ~230 releases of npm, but nodist still only recognizes the latest 100.
Did you close this as you don't intend to implement it? If so, if I was to provide an implementation any particular requirements you'd have? Simplest would be to look at the Link header and iterate through the pages to built the full list of releases, but that means 3x the queries every time an npm operation is done.
@jshumaker-accusoft I am going to go ahead and re-open this. I was under the impression it was working as intended.
The real issue here is the API we are asking about the versions they are clearly handing us a shortened result. Either code needs to be applied to fetch the remaining entries, perhaps on a page 2 or a different API call to list all the versions.
nodist npm add 3.5.2
Fails with
Cannot read property 'trim' of null.
Looking at the code, it's largely because semver.validRange thinks that an exact version is a range.
https://github.com/marcelklehr/nodist/blob/7a971d1d9c05f0a2bb98f8e3e0fadf5a20d699db/lib/npm.js#L190
The code then applies the "range" to the releases it pulled, except it's limited to the last 100 because the code only pulls the latest 100 releases, because requesting more would require multiple calls for multiple pages.
As a temporary fix for my local copy, I modified the if statement to exclude versions that are just a basic semver and not a range from going through range matching.
if(!v.match(/[0-9]+\.[0-9]+\.[0-9]+/) && semver.validRange(v)){
Maybe an acceptable solution? seems like there's a few other spots in the code that could use that.
Probably better long-term solution is to cache the versions, and only check for new versions if cache is older than X time, and retrieve multiple pages of releases until you hit a version in the cache already. That however is much more complicated to implement, and the above got us rolling again.
The text was updated successfully, but these errors were encountered: