diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 0caba7241..c41ba088b 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -24,6 +24,7 @@ Release with new features and bugfixes: * https://github.com/devonfw/IDEasy/issues/1719[#1719]: Add Rust and MSVC support * https://github.com/devonfw/IDEasy/issues/1991[#1991]: Improve WindowsHelperMock * https://github.com/devonfw/IDEasy/issues/1457[#1457]: Improve CLI error messages on invalid args or commandlets not available in current context +* https://github.com/devonfw/IDEasy/issues/1965[#1965]: Improve dependent installations for npm and pip based commandlets The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/45?closed=1[milestone 2026.06.001]. 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..afe80bcdd 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 @@ -65,7 +65,7 @@ private VersionIdentifier runPackageManagerGetInstalledVersion(String npmPackage ProcessContext pc = this.context.newProcess().errorHandling(ProcessErrorHandling.THROW_CLI) .withExitCodeAcceptor(rc -> true); // if the tool is not installed npm list will end with exit code 1 request.setProcessContext(pc); - ProcessResult result = runPackageManager(request); + ProcessResult result = runPackageManager(request, true); if (result.isSuccessful()) { List versions = result.getOut(); String parsedVersion = null; @@ -84,4 +84,10 @@ private VersionIdentifier runPackageManagerGetInstalledVersion(String npmPackage return null; } + @Override + protected boolean isSkipInstallation() { + Npm npm = this.context.getCommandletManager().getCommandlet(Npm.class); + return npm.isInstalled(); + } + } diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/pip/PipBasedCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/tool/pip/PipBasedCommandlet.java index b94a4124d..e096c43ef 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/pip/PipBasedCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/pip/PipBasedCommandlet.java @@ -110,7 +110,7 @@ protected VersionIdentifier computeInstalledVersion() { } PackageManagerRequest request = new PackageManagerRequest("show", getPackageName()).setProcessMode(ProcessMode.DEFAULT_CAPTURE) .setProcessContext(this.context.newProcess().errorHandling(ProcessErrorHandling.NONE)); - ProcessResult processResult = runPackageManager(request); + ProcessResult processResult = runPackageManager(request, true); if (processResult.isSuccessful()) { for (String line : processResult.getOut()) { // we are looking for something like "Version: 25.3"