将我的 macOS 升级到 10.15 (Catalina) 和 switching from bash to zsh 后按照建议,我尝试从终端启动 svcutil(或任何其他 .NET Core 工具),但收到以下错误消息:
zsh: command not found: dotnet-svcutil
奇怪,因为在使用 echo $PATH
检查路径时提到了它的位置(~/.dotnet/tools
,默认安装 .NET Core 工具的位置) 。我该如何解决这个问题?
最佳答案
如上所述here , zsh 不支持路径中的 ~
。 .NET Core 工具的路径条目在安装过程中作为文件 /etc/paths.d/dotnet-cli-tools
添加,路径条目为 ~/.dotnet/tools
>。将其更改为 $HOME/.dotnet/tools
或 ${HOME}/.dotnet/tools
没有帮助,但将其更改为实际路径(例如 /Users/Glorfindel/.dotnet/tools
)成功了。
另一个选择是重新安装该工具,例如与
dotnet tool uninstall --global dotnet-svcutil
dotnet tool install --global dotnet-svcutil
安装程序会告诉你以下信息,我没有尝试过:
Tools directory '/Users/Glorfindel/.dotnet/tools' is not currently on the PATH environment variable.
If you are using zsh, you can add it to your profile by running the following command:cat << \EOF >> ~/.zprofile # Add .NET Core SDK tools export PATH="$PATH:/Users/Glorfindel/.dotnet/tools" EOF
And run
zsh -l
to make it available for current session.You can only add it to the current session by running the following command:
export PATH="$PATH:/Users/Glorfindel/.dotnet/tools"
关于.net-core - 升级到 macOS Catalina 后为 "zsh: command not found: dotnet-svcutil",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58320592/