How do I uninstall a Chocolatey package and all its dependencies?
Asked Answered
A

1

20

Reading the documentation, it appears that I should be able to install package and its dependencies with the -x flag. But when I try to uninstall the javaruntime package with the command choco uninstall javaruntime -x, it fails because of dependencies.

It gives me this error:

>  choco uninstall javaruntime -x
Chocolatey v0.10.1
Uninstalling the following packages:
javaruntime
javaruntime not uninstalled. An error occurred during uninstall:
 Unable to uninstall 'javaruntime 8.0.101' because 'groovy 2.3.6' depends on it.

Chocolatey uninstalled 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - javaruntime (exited 1) - javaruntime not uninstalled. An error occurred during uninstall:
 Unable to uninstall 'javaruntime 8.0.101' because 'groovy 2.3.6' depends on it.

Am I doing something wrong?

Anglesite answered 22/9, 2016 at 0:55 Comment(1)
Groovy is not a dependency of JavaRuntime, it has a dependency on JavaRuntime. So if you ran choco uninstall groovy -x it would remove javaruntime and then groovy (although javaruntime may fail if other things depend on it). I think we all want a switch to remove something regardless of the things that depend on it.Leiker
M
34

Try this:

choco uninstall webdeploy -x

The webdeploy can be change to your target package you want to uninstall.

Enter image description here

Maniple answered 6/7, 2018 at 5:46 Comment(2)
where -x, same as the --forcedependencies, --removedependencies. Uninstall dependencies when uninstalling package. Defaults to false.Backus
The above command force rebooted my PC without confirmation or warning!Yul

© 2022 - 2024 — McMap. All rights reserved.