Chocolatey 安装:警告:您很可能需要关闭并重新打开 shell

Chocolatey Install: WARNING: It's very likely you will need to close and reopen your shell

第一次尝试使用 Chef 和 Chocolatey cookbook 安装 Chocolatey 时,我在我的 Chef-零配置中收到消息 运行:

WARNING: It's very likely you will need to close and reopen your shell

当需要安装我在 Chocolatey 食谱的属性文件中列出的应用程序时,它失败了,因为找不到命令 "choco"。当我第二次提供时一切正常。

我尝试在 Chocolatey 食谱中重新启动 powershell,但失败了。我想知道是否还有其他人 运行 参与其中,是否有变通办法。

这是 STDERR 的输出:

==> default:     STDOUT:
==> default:     STDERR: C:\Users\vagrant\AppData\Local\Temp\chef-script20160425-2280-k20yic.ps1 : The
==> default:
==> default:     term 'choco' is not recognized as the name of a cmdlet, function, script file,
==> default:
==> default:     or operable program. Check the spelling of the name, or if a path was
==> default:
==> default:     included, verify that the path is correct and try again.
==> default:
==> default:         + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorExcep
==> default:
==> default:        tion
==> default:
==> default:         + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
==> default:
==> default:        n,chef-script20160425-2280-k20yic.ps1
==> default:     ---- End output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20160425-2280-k20yic.ps1" ----
==> default:     Ran "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20160425-2280-k20yic.ps1" returned 1

如警告所述,您需要重新启动 shell 或其他进程以获取对 $PATH 的全局修改。