atom-haskell-archive / haskell-ghc-mod

haskell-ghc-mod atom package
https://atom.io/packages/haskell-ghc-mod
MIT License
69 stars 20 forks source link

Uncaught Error: spawn ENOTDIR #26

Closed stevenhood closed 8 years ago

stevenhood commented 9 years ago
  1. Opened ninetynineproblems.hs that is in a cabal project.
  2. Pressed Ctrl + s to save the file.
  3. Get the following error every time I save the file: Haskell-ghc-mod: ghc-mod failed with error code 1
  4. Then got an error: Uncaught Error: spawn ENOTDIR

Atom Version: 0.209.0 System: Ubuntu 14.04.2 Thrown From: haskell-ghc-mod package, v0.7.5

Stack Trace

Uncaught Error: spawn ENOTDIR

At child_process.js:1145

Error: spawn ENOTDIR
    at exports._errnoException (util.js:734:11)
    at ChildProcess.spawn (child_process.js:1145:11)
    at Object.exports.spawn (child_process.js:977:9)
    at GhcModiProcessTemp.module.exports.GhcModiProcessBase.spawnProcess (/home/steven/.atom/packages/haskell-ghc-mod/lib/ghc-modi-process-base.coffee:43:17)
    at GhcModiProcessTemp.spawnProcess (/home/steven/.atom/packages/haskell-ghc-mod/lib/ghc-modi-process-base.coffee:3:61)
    at GhcModiProcessTemp.module.exports.GhcModiProcessTemp.runModiCmd (/home/steven/.atom/packages/haskell-ghc-mod/lib/ghc-modi-process-temp.coffee:114:22)
    at GhcModiProcessTemp.runModiCmd (/home/steven/.atom/packages/haskell-ghc-mod/lib/ghc-modi-process-temp.coffee:3:61)
    at GhcModiProcessTemp.module.exports.GhcModiProcessTemp.run (/home/steven/.atom/packages/haskell-ghc-mod/lib/ghc-modi-process-temp.coffee:60:23)
    at GhcModiProcessTemp.run (/home/steven/.atom/packages/haskell-ghc-mod/lib/ghc-modi-process-temp.coffee:3:61)
    at GhcModiProcess.module.exports.GhcModiProcess.runQueuedCommands (/home/steven/.atom/packages/haskell-ghc-mod/lib/ghc-modi-process.coffee:164:27)

Commands

     -0:41 core:save (atom-text-editor.editor.is-focused)
     -0:41 ide-haskell:check-file (atom-text-editor.editor.is-focused)
     -0:41 ide-haskell:lint-file (atom-text-editor.editor.is-focused)

Config

{
  "core": {}
}

Installed Packages

# User
autocomplete-haskell, v0.4.4
haskell-ghc-mod, v0.7.5
ide-haskell, v0.5.12
language-haskell, v1.1.1

# Dev
No dev packages
lierdakil commented 9 years ago

Could you try opening whole project directory in Atom? E.g. atom /path/to/project_dir

ENOTDIR would probably mean that project directory detection fails. My guess is that you open standalone file instead of a project directory. If I'm wrong, please correct me.

stevenhood commented 9 years ago

I opened the project directory using the full path from the root, but still getting the same error. And yes you're right, I was opening the file instead of the project directory.

lierdakil commented 9 years ago

That's... weird. Could you check developer console for any messages that might provide some insight?

stevenhood commented 9 years ago

Each time I save the file I get "Haskell-ghc-mod: ghc-mod failed with error code 1". In the console there are messages starting with Array[0] for each of these errors. Apart from that, there's nothing other than what's already in the report.

lierdakil commented 9 years ago

Okay, I'm stumped. Let's do a quick sanity check. What versions of ghc-mod and ghc are you running?

lierdakil commented 9 years ago

I've also released v0.7.6 with more verbose debugging output. You can enable it in haskell-ghc-mod settings.

Things to check for:

You can also copy-paste whole dev. console log here, if you wish. Hopefully that would get us something to understand underlying issue better.

Thanks.

stevenhood commented 9 years ago

ghc: version 7.8.4 ghc-mod: version 5.2.1.2

GUI: 'ghc-modi' could not be spawned. Is it installed and on your path? If so please open an issue on the package spawning the process.

Console:

haskell-ghc-mod debug: Checking for ghc-modi in /home/steven/Programming/99haskellproblems
/home/steven/.atom/packages/haskell-ghc-mod/lib/util.coffee:15 haskell-ghc-mod debug: Spawning new ghc-modi instance for /home/steven/Programming/99haskellproblems with options.cwd = /home/steven/Programming/99haskellproblems,options.env = [object Object]
/home/steven/.atom/packages/haskell-ghc-mod/lib/util.coffee:15 haskell-ghc-mod debug: Running ghc-modi command type,/home/steven/Programming/99haskellproblems/99problems.hs,,2,5
events.js:141 Uncaught Error: write EPIPE
events.js:141 Uncaught Error: spawn ghc-modi ENOENT
lierdakil commented 9 years ago

That's... different. Another sanity check, is ghc-mod/ghc-modi on your PATH? Either way, could you try to specify full path to ghc-mod and ghc-modi executables in haskell-ghc-mod settings?

lierdakil commented 9 years ago

And by the way, /home/steven/Programming/99haskellproblems is a directory, right?

stevenhood commented 9 years ago

Yeah it's a directory. Feel a bit stupid now; realised that I don't have ghc-modi installed! For some reason it wasn't installed when I ran cabal install ghc-mod. I'll try to reinstall ghc-mod and see if it includes it this time. Edit: Removed and reinstalled ghc-mod 5.2.1.2, still no ghc-modi included in the install.

lierdakil commented 9 years ago

@stevenhood, it's been a while. Have you resolved your problem?

stevenhood commented 9 years ago

I haven't I'm afraid. I tried to reinstall ghc-mod using cabal but ghc-modi never gets installed with it for some reason :/

lierdakil commented 9 years ago

Well, as a fallback, you can disable ghc-modi in haskell-ghc-mod settings (uncheck relevant checkmark). That will be noticeably slow, however.

I have literally no idea how is it possible that ghc-modi isn't installed. cabal install installs into $HOME/.cabal/ by default FYI, so you might want to check there. cabal install -g I think installs into /usr/local, but on that, I'm not sure.

stevenhood commented 9 years ago

Turns out ghc-modi was installed! I was looking in /usr/local when it was in $HOME/.cabal/ all along. I've since added it to $PATH, and now I'm not getting any errors related to it any more.

However, I still get Haskell-ghc-mod: /usr/bin/ghc-mod failed with error code 1 each time I save a .hs file.

lierdakil commented 9 years ago

This could be related to cabal misconfiguration or missing dependencies. Try running cabal configure in project directory. If it complains about missing dependencies, you can try cabal sandbox init && cabal install --only-dependencies, which will install sandboxed environment.