From 98a7761e06bff9a6c84153bf566e36c838228a67 Mon Sep 17 00:00:00 2001 From: Oski Kervinen Date: Fri, 13 Jan 2023 11:10:39 +0200 Subject: [PATCH] Fixed: #250 cannot install new npm versions The NPM project has started releasing utility libraries in its releases feed. Instead of being named "v", they are named ": v". This unexpected format causes an error like: "Invalid Version: libnpmversion-v3.0.1." whenever you call "nodist npm add". Solution: Filter away the other packages when fetching the releases. --- lib/npm.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/npm.js b/lib/npm.js index 16ef5cca..8ff04f4a 100644 --- a/lib/npm.js +++ b/lib/npm.js @@ -57,7 +57,15 @@ NPMIST.listAvailable = function(){ per_page: '100' }) ]) - .then(([npm, cli]) => npm.concat(cli)); + .then(([npm, cli]) => { + // The npm project has two kinds of releases: releases of npm, + // and releases of other utility libraries. + // Ignore the releases of libraries. They are named "package: version", + // while core npm releases are named just "version". + cli = cli.filter( release => release.name.indexOf(':') < 0 ); + + return npm.concat(cli); + }); }; /**