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

spawn error #7

Closed sneiman closed 9 years ago

sneiman commented 9 years ago

getting this error msg when I open a haskell src file:

'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.

ghc-modi is installed and is in the current path. I can make this work by explicitly putting the path in the pkg settings within atom

lierdakil commented 9 years ago

Are you on mac? It's a known problem that starting Atom from Finder ignores PATH settings.

sneiman commented 9 years ago

Yes on mac and ubuntu – thanks. This entire message is confidential. If it isn't intended for you, you may not use it – so please throw it away and forget about it.

From: Nikolay Yakimov notifications@github.com<mailto:notifications@github.com> Reply-To: lierdakil/haskell-ghc-mod reply@reply.github.com<mailto:reply@reply.github.com> Date: Tuesday, March 31, 2015 at 12:38 AM To: lierdakil/haskell-ghc-mod haskell-ghc-mod@noreply.github.com<mailto:haskell-ghc-mod@noreply.github.com> Cc: Seth Neiman seth@lizardms.com<mailto:seth@lizardms.com> Subject: Re: [haskell-ghc-mod] spawn error (#7)

Are you on mac? It's a known problem that starting Atom from Finder ignores PATH settings.

— Reply to this email directly or view it on GitHubhttps://github.com/lierdakil/haskell-ghc-mod/issues/7#issuecomment-87979510.

newhoggy commented 9 years ago

So do I put /Users/john/Library/Haskell/bin/ghc-mod or /Users/john/Library/Haskell/bin? Neither works for me.

Could be useful to have a test settings button.

lierdakil commented 9 years ago

@newhoggy, Atom has no API to add a "test settings" button, not that I know of.

You need to specify full path to ghc-mod, i.e. full path to binary file. So it probably should be former. If it doesn't work for you, please create a new issue with full error message (and any relevant dev console messages, if possible) attached.

Also try starting Atom from terminal and see if problem goes away. If it does, it's probably Atom failing to find ghc. You can update your atom startup script to set PATH. It's an upstream problem -- I might consider working around it if it's not fixed sometime soon, but I still hope it will be.

newhoggy commented 9 years ago

I ran atom from the command line with the full path to binary file.

I don't get the 'could not be spawned' error any more.

I still get various other errors like this one when I press CTRL+ALT+T

events.js:141
Hide Stack Trace
Error: This socket is closed.
    at Socket._writeGeneric (net.js:634:19)
    at Socket._write (net.js:687:8)
    at doWrite (_stream_writable.js:295:12)
    at writeOrBuffer (_stream_writable.js:282:5)
    at Socket.Writable.write (_stream_writable.js:210:11)
    at Socket.write (net.js:612:40)
    at GhcModiProcess.module.exports.GhcModiProcess.runCmd (/Users/john/.atom/packages/haskell-ghc-mod/lib/ghc-modi-process.coffee:117:35)
    at /Users/john/.atom/packages/haskell-ghc-mod/lib/ghc-modi-process.coffee:174:24
    at /Users/john/.atom/packages/haskell-ghc-mod/lib/ghc-modi-process.coffee:160:16
    at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/temp/lib/temp.js:252:7
lierdakil commented 9 years ago

@newhoggy "This socket is closed" basically means ghc-modi (persistent version of ghc-mod) crashes. Note to self: I really should work on error messages. As for solving your particular problem, here are some pointers:

  1. ghc-modi does not work for files with spaces in path. It's upstream bug, unfixed atm. No solution but to disable ghc-modi. Try to uncheck 'Enable ghc-modi' in haskell-ghc-mod settings, if you have such files.
  2. Check if ghc-mod works from terminal, i.e. cd to project directory and run ghc-mod check src/Main.hs or whatever is your main file. There is a chance that your project is misconfigured in some way.
  3. There is a known problem with ghc-mod being built with version of cabal that differs from one you have in PATH. See https://github.com/kazu-yamamoto/ghc-mod/wiki/InconsistentCabalVersions
newhoggy commented 9 years ago

It was a problem with ghc-mod.

I finally got this to work over the weekend with the following GHC 7.10 stack:

lierdakil commented 9 years ago

@newhoggy, see https://github.com/atom-haskell/haskell-ghc-mod/issues/18 for information on support for master branch of ghc-mod.