我一直在尝试从PowerShell管理软件包,但是它似乎在显示PowerShell,因为他找不到软件包或其依赖项而出错(我使用Chocolatey作为源) 命令和结果:
register-packagesource -name chocolatey -providername chocolatey -location https://chocolatey.org/api/v2
Name ProviderName IsTrusted Location
---- ------------ --------- --------
chocolatey Chocolatey False https://chocolatey.org/api/v2
find-package -providername chocolatey -name notepad
Name Version Source Summary
---- ------- ------ -------
xml-notepad 2.8.0.7 chocolatey A simple XML editor.
crypto-notepad 1.6.7 chocolatey Crypto Notepad allows you to create secure notes using AES algorithms.
ProgrammersNotepad 2.4.2 chocolatey Programmer's Notepad is a fast, lightweight text editor for Windows.
programmersnotepad.install 2.4.2 chocolatey Programmer's Notepad is a fast, lightweight text editor for Windows.
notepad2 4.2.25.20160422 chocolatey A fast and light-weight Notepad-like text editor with syntax highlighting.
notepadplusplus.install 7.8.9 chocolatey Notepad++ is a free (as in "free speech" and also as in "free beer") source code editor and Notepad replacement that supports several languages.
notepadplusplus 7.8.9 chocolatey Notepad++ is a free (as in "free speech" and also as in "free beer") source code editor and Notepad replacement that supports several languages.
install-package -providername chocolatey -name notepadplusplus
The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'chocolatey'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A
WARNING: NuGet: System.InvalidOperationException: Unable to find version '1.3.5.1' of package 'chocolatey-core.extension'.
WARNING: NuGet: at NuGet.PackageRepositoryHelper.ResolvePackage(IPackageRepository sourceRepository, IPackageRepository localRepository, IPackageConstraintProvider constraintProvider, String packageId, SemanticVersion version,
Boolean allowPrereleaseVersions)
WARNING: NuGet: at NuGet.PackageManager.InstallPackage(String packageId, SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersions)
WARNING: NuGet: at NuGet.Commands.InstallCommand.InstallPackage(IFileSystem fileSystem, String packageId, SemanticVersion version)
WARNING: NuGet: at NuGet.Program.Main(String[] args)
WARNING: NuGet: System.InvalidOperationException: Unable to find version '7.8.9' of package 'notepadplusplus.install'.
WARNING: NuGet: System.InvalidOperationException: Unable to find version '7.8.9' of package 'notepadplusplus'.
从我从install-package命令后的错误中了解到的是找不到程序和程序依赖项的错误。尽管我确实设法使用find-package找到了“ chocolatey-core.extension”,如下面所示,以及程序本身,如第二条命令所示。我尝试以相同的方式安装其他软件包,但没有成功。
find-package -providername chocolatey -name chocolatey-core.extension
Name Version Source Summary
---- ------- ------ -------
chocolatey-core.extension 1.3.5.1 chocolatey Helper functions extending core choco functionality
非常感谢所有帮助,谢谢。