1

我目前在使用 Visual Studio 代码和 erlang 时遇到问题,我的 PC 上安装了 erlang/OTP,并且我已经为 Visual Studio 代码安装了 erlang 插件,但是我无法从内部终端窗口运行 erlang。当我尝试收到此错误时:

erl : The term 'erl' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:1
+ erl
+ ~~~
+ CategoryInfo          : ObjectNotFound: (erl:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

任何帮助,将不胜感激。

4

2 回答 2

4

来自VS 文档

[由 VS] 使用的 shell [即] 在 Linux 和 OS X 上默认为 $SHELL,在 Windows 上默认为 %COMSPEC%。这些可以通过设置手动覆盖 terminal.integrated.shell.*

所以我会检查你的%COMSPEC%环境变量的值是什么。或者,您可以%COMSPEC%在 VS 设置中覆盖:

VS 文档

在 Windows 上正确配置 shell 就是找到正确的可执行文件。VS Code 默认为 Windows 上的 %COMSPEC% 环境变量,它通常指向 32 位版本的 cmd.exe。

以下是常见 shell 可执行文件及其默认位置的列表:

// 64-bit cmd if available, otherwise 32-bit
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\cmd.exe"
// 64-bit PowerShell if available, otherwise 32-bit
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"
// Git Bash
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
// Bash on Ubuntu (on Windows)
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe"

您可能还想检查 erlang 的路径是否在您的%PATH%环境变量中,如果没有则添加它。您之前是否曾成功启动过 erlang shell,例如在您安装 erlang 以测试它是否正常工作之后?

于 2017-02-07T17:50:09.340 回答
0

尝试以下指南并安装 erlang

https://www.rose-hulman.edu/Users/faculty/young/CS-Classes/resources/Erlang/index.html

于 2017-02-07T09:58:11.580 回答