Atom编辑器中Idris报错:找不到可执行文件及编译器崩溃
Hey there! Let's work through those frustrating errors you're seeing when using Idris in Atom. The root issue here is that Atom's Idris package can't locate the actual Idris executable you installed via Hackage, which is why it's throwing those "couldn't find executable" and crash messages. Here's how to resolve this step by step:
Step 1: Find your Idris executable path
First, we need to confirm exactly where your Idris binary is located on your system:
- Linux/macOS: Open your terminal and run
which idris. You'll get an output like/usr/local/bin/idrisor~/.cabal/bin/idris. - Windows: Open Command Prompt and run
where idris. The output might look likeC:\Users\YourUsername\AppData\Roaming\cabal\bin\idris.exe.
Make a note of this full path—we'll need it for the next step.
Step 2: Configure Atom's Idris package to use the correct path
- Open Atom and go to Settings (use the shortcut
Ctrl+,on Windows/Linux,Cmd+,on macOS). - Switch to the Installed tab, then search for the "Idris" package in the list.
- Click the Settings button next to the Idris package to open its configuration page.
- Look for the Idris Path field. By default, it's probably set to just
"Idris"—replace this with the full path you found in Step 1.- Example for Linux/macOS:
/home/yourname/.cabal/bin/idris - Example for Windows:
C:\\Users\\yourname\\AppData\\Roaming\\cabal\\bin\\idris.exe(note the double backslashes, or use forward slashes likeC:/Users/yourname/AppData/Roaming/cabal/bin/idris.exe)
- Example for Linux/macOS:
Step 3: Test the fix
Restart Atom, open your Idris source file, and try running a type check (use the shortcut Ctrl+Alt+C on Windows/Linux, Cmd+Alt+C on macOS). The errors should now be gone if the path was set correctly.
Extra troubleshooting tips if it's still not working
- Verify that Idris works outside Atom: Run
idris --versionin your terminal/Command Prompt. If this doesn't return a version number, your Hackage installation might be incomplete—reinstall Idris viacabal install idrisand make sure the installation finishes without errors. - Check file permissions: On Linux/macOS, ensure the Idris executable has execute permissions. Run
chmod +x /path/to/idrisif needed. - For macOS users with SIP enabled: Avoid installing Idris in system-protected directories like
/usr/bin—stick to user directories like~/.cabal/bininstead.
内容的提问来源于stack exchange,提问作者Joshua Norris

