atom-haskell / ide-haskell-repl

GHCi REPL in Atom
https://atom.io/packages/ide-haskell-repl
MIT License
26 stars 8 forks source link

REPL not opening and then crashing #5

Closed totano closed 8 years ago

totano commented 9 years ago

Atom Version: 1.2.2 System: Microsoft Windows 10 Pro package version: 0.0.4

When clicking on Haskell IDE - Open REPL in the menu nothing happens, nothing is logged in the developer tools. After trying some more times the REPL window appears with text:

GHCI crashed Error: write EPIPEGHCI crashed Error: spawn C:\WINDOWS\system32\cmd.exe ENOENT

/<UserHome>.atom/packages/ide-haskell-repl/lib/ghci.coffee:43 Error: write EPIPE
at exports._errnoException (util.js:837:11)
at Socket._writeGeneric (net.js:675:26)
at Socket._write (net.js:694:8)
at doWrite (_stream_writable.js:292:12)
at writeOrBuffer (_stream_writable.js:278:5)
at Socket.Writable.write (_stream_writable.js:207:11)
at Socket.write (net.js:618:40)
at new GHCI (file:///<UserHome>.atom/packages/ide-haskell-repl/lib/ghci.coffee:79:19)
at new IdeHaskellReplView (file:///<UserHome>.atom/packages/ide-haskell-repl/lib/ide-haskell-repl-view.coffee:55:17)
at <UserHome>\.atom\packages\ide-haskell-repl\lib\ide-haskell-repl.coffee:39:11
at Workspace.module.exports.Workspace.openURIInPane (<UserHome>\AppData\Local\atom\app-1.2.2\resources\app.asar\src\workspace.js:454:22)
at Workspace.module.exports.Workspace.open (<UserHome>\AppData\Local\atom\app-1.2.2\resources\app.asar\src\workspace.js:393:19)
at Object.module.exports.IdeHaskellRepl.open (<UserHome>\.atom\packages\ide-haskell-repl\lib\ide-haskell-repl.coffee:56:20)
at atom-text-editor.disposables.add.atom.commands.add.ide-haskell-repl:toggle (<UserHome>\.atom\packages\ide-haskell-repl\lib\ide-haskell-repl.coffee:43:10)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (<UserHome>\AppData\Local\atom\app-1.2.2\resources\app.asar\src\command-registry.js:260:29)
at CommandRegistry.handleCommandEvent (<UserHome>\AppData\Local\atom\app-1.2.2\resources\app.asar\src\command-registry.js:3:61)
at CommandRegistry.module.exports.CommandRegistry.dispatch (<UserHome>\AppData\Local\atom\app-1.2.2\resources\app.asar\src\command-registry.js:160:19)
at AtomEnvironment.module.exports.AtomEnvironment.dispatchApplicationMenuCommand (<UserHome>\AppData\Local\atom\app-1.2.2\resources\app.asar\src\atom-environment.js:987:28)
at emitOne (events.js:77:13)
at EventEmitter.emit (events.js:169:7)(anonymous function) @ /<UserHome>.atom/packages/ide-haskell-repl/lib/ghci.coffee:43

/<UserHome>.atom/packages/ide-haskell-repl/lib/ghci.coffee:43 Error: spawn C:\WINDOWS\system32\cmd.exe ENOENT
at exports._errnoException (util.js:837:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at doNTCallback2 (node.js:441:9)
at process._tickCallback (node.js:355:17)(anonymous function) @ /<UserHome>.atom/packages/ide-haskell-repl/lib/ghci.coffee:43
lierdakil commented 9 years ago

I have literally no idea why it tries to run C:\WINDOWS\system32\cmd.exe and why it can't find it. It appears package is misconfigured? Anyway, try to specify full path to ghci/cabal in package settings.

You need to have a Haskell file open, otherwise repl won't know in what context to run (technically, this command is bound to an editor instance)

SecondReality commented 8 years ago

I've got the exact same error text a few times, even when opening from a Haskell file. I'm not sure what I did to fix it (quit and restarted ATOM a few times), but eventually the repl worked.

lierdakil commented 8 years ago

Any insight is appreciated. I have no idea how to reproduce this issue or what's causing it. ← definitely not a Windows user

totano commented 8 years ago

I updated haskell ide packages and Atom to latest version, now it is working

cfscholl commented 8 years ago

I hope this might help you, it seems like this issue manifest itself when there is a space in the pathname to the Haskell file.

simonmichael commented 8 years ago

I see the same symptom with latest packages on OSX. I have Command Path "stack", Command Args "ghci". Haskell IDE -> Open REPL opened a pane on right showing

GHCI crashed
Error: spawn stack ENOENT

Configuring the full path to the stack binary didn't help.

Also, in the Haskell IDE panel the REPL tab is always blank. I don't know if this is related to ide-haskell-repl.

Thanks!

lierdakil commented 8 years ago

@simonmichael this is not the same.

Put full path to stack binary in 'Command Path', e.g. /Users/simon/Haskell/bin/stack. Double-check that this file actually exists (do ls ... in terminal or something). Then, if error persists, copy error message verbatim.

REPL tab shows errors and warnings. It will be empty initially.

ghost commented 8 years ago

sorry to hijack this issue but I ran into the same problem. Can you explain in steps where I have to put the command path ?

lierdakil commented 8 years ago

image

ghost commented 8 years ago

I did that but now this error message :

GHCI crashed 
 Error : spawn /usr/bin/stack enoent 

but stack is there . See

ls /usr/bin/stack 
/usr/bin/stack 
lierdakil commented 8 years ago

I assume you didn't post error message verbatim, since ENOENT would be capitalized. Make sure there are no rogue spaces or other whitespace characters before or after /usr/bin/stack. If that's not it, then I have no idea what's wrong. Maybe package/Atom/nodejs installation is broken somehow. Maybe your system permissions are borked in some exotic way. Maybe I'm just an idiot. But this very configuration works for me.

ghost commented 8 years ago

Oke,the culprit were a few spaces after /usr/bin/stack

Now I hope I can find out how to send a function to the repl

lierdakil commented 8 years ago

ide-haskell-repl:exec-command (Shift ⇧+ Enter ⏎ by default)?

ghost commented 8 years ago

Thanks, found out already. I cannot send a function which is in a .hs file to repl ? I have to load or copy it into the ghci part. Right ?

lierdakil commented 8 years ago

Repl loads in the context of file currently open, provided stack is aware of it (i.e. it's in your cabal file). So any top-level definitions should already be available in repl context.

lierdakil commented 8 years ago

Other than that, you can use usual ghci commands like :load.

ghost commented 8 years ago

Thanks

lierdakil commented 8 years ago

This would seem to have been mostly resolved. Closing due to age and lack of activity. Feel free to open new issues if needed.