当我安装 Chocolatey 时,出现如下错误:
...
WARNING: It's very likely you will need to close and reopen your shell
before you can use choco.
...
WARNING: You can safely ignore errors related to missing log files when
upgrading from a version of Chocolatey less than 0.9.9.
'Batch file could not be found' is also safe to ignore.
'The system cannot find the file specified' - also safe.
WARNING: Not setting tab completion: Profile file does not exist at
'C:\Users\Chelsea
\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
...
Run Code Online (Sandbox Code Playgroud)
我该如何解决该错误?
以下是选项卡完成警告的解决方案:
打开 PowerShell 会话并运行:notepad $profile这将在记事本中打开配置文件。
将以下代码复制并粘贴到记事本中并保存文件:
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
Run Code Online (Sandbox Code Playgroud)
资料来源:https://docs.chocolatey.org/en-us/troubleshooting#why-does-choco-tab-not-work-for-me
我自己刚刚遇到这个警告。出现这种情况是因为您的 Windows 用户不存在现有的 PowerShell 配置文件。
要创建配置文件,请打开 PowerShell 会话并输入:
if (!(Test-Path -Path $PROFILE)) {
New-Item -ItemType File -Path $PROFILE -Force
}
Run Code Online (Sandbox Code Playgroud)
我从微软的文档中提取了上面的代码。如果您有兴趣,该页面涵盖了有关个人资料的更多信息。
| 归档时间: |
|
| 查看次数: |
11435 次 |
| 最近记录: |