diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index bbfe75087..37f26d018 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -29,6 +29,7 @@ Release with new features and bugfixes: * https://github.com/devonfw/IDEasy/issues/1685[#1685]: Add Nest CLI to IDEasy commandlets * https://github.com/devonfw/IDEasy/issues/1882[#1882]: Add AWS CDK to IDEasy commandlets * https://github.com/devonfw/IDEasy/issues/800[#800]: Fix infinite recursion in Sonar start/stop on macOS +* https://github.com/devonfw/IDEasy/issues/1886[#1886]: Fix NpmBasedCommandlet shows wrong tool version after install * https://github.com/devonfw/IDEasy/issues/1716[#1716]: Add commandlet for Claude Code CLI * https://github.com/devonfw/IDEasy/issues/1844[#1844]: Fix vscode installation hanging indefinitely in WSL Linux environments diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/npm/NpmBasedCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/npm/NpmBasedCommandlet.java index 93eeb3976..b96d3049d 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/npm/NpmBasedCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/npm/NpmBasedCommandlet.java @@ -1,6 +1,7 @@ package com.devonfw.tools.ide.tool.npm; import java.nio.file.Files; +import java.nio.file.Path; import java.util.List; import java.util.Set; @@ -50,6 +51,17 @@ public ToolRepository getToolRepository() { return this.context.getNpmRepository(); } + /** + * Override to ignore the toolPath parameter and use npm package manager to detect the actual installed version of the tool. + * + * @param toolPath the installation {@link Path} where to find the version file. + * @return the installed version or null if not installed. + */ + @Override + protected VersionIdentifier getInstalledVersion(Path toolPath) { + return computeInstalledVersion(); + } + @Override protected VersionIdentifier computeInstalledVersion() { return runPackageManagerGetInstalledVersion(getPackageName());