halohalospecial / atom-elmjutsu

A bag of tricks for developing with Elm. (Atom package)
https://atom.io/packages/elmjutsu
MIT License
192 stars 24 forks source link

How do I correctly specify a relative Elm Path? #141

Closed mrattner closed 5 years ago

mrattner commented 5 years ago

In elmjutsu config, my value for Elm Path is node_modules/.bin/elm. When I run the linter in an Elm file, I get "Error parsing output. Please check the value of Elm Path and/or Elm Test Path in the Settings view."

Looking at the Atom debugger, I see that the Elm executable's full path is expanded correctly to /home/marcy/elm-project/node_modules/.bin/elm, but the spawned process exits with code 127 (command not found). When I recreate the command myself from within the same working directory, in my system terminal:

~/elm-project$  /home/marcy/elm-project/node_modules/.bin/elm make --report=json --output=/dev/null /home/marcy/elm-project/src/Main.elm

the Elm compiler executes successfully. Any advice?

halohalospecial commented 5 years ago

Hi! Can you check the value of executablePath, args, and projectDirectory at line 111?

https://github.com/halohalospecial/atom-elmjutsu/blob/4d5e2055ccf164f51b3df17d6f7f90c00642d510/lib/elm-make-runner.js#L108-L118

Thanks!

gampleman commented 5 years ago

I'm getting the same error. In my case:

executablePath is /Users/gampleman/Programming/fmap/project/client/node_modules/.bin/elm which seems correct.

args is ["make", "--report=json", "--output=/dev/null", "/Users/gampleman/Programming/fmap/project/client/src/Main.elm"]

projectDirectory is /Users/gampleman/Programming/fmap/project/client

halohalospecial commented 5 years ago

@gampleman, @mrattner, can you try uncommenting // env: process.env,? Thanks!

gampleman commented 5 years ago

Sure.

After the promise resolves, data.stderr is "env: node: No such file or directory"

mrattner commented 5 years ago

I haven't had the time to dig into this error, so thanks @gampleman for providing more info. That "node: No such file or directory" error you're seeing reminds me of a problem I've run into a couple of times, because of how the Node binary is named in some package managers (nodejs vs node--see this stackoverflow post for more info). Even though I installed Node via n-install, I had to create a symlink from node to nodejs after I upgraded my Linux distro. Maybe that's related to this problem?

halohalospecial commented 5 years ago

@gampleman, @mrattner, I created a branch (sb-exec-local) that uses the local option of sb-exec (https://github.com/steelbrain/exec#optionslocal) when Elm Path is node_modules/.bin/elm. Not sure if it will make any difference since I didn't encounter compile issues without it :)

https://github.com/halohalospecial/atom-elmjutsu/blob/8069f0a075cc64dbc8e6fad6d1d09d89bbb79b0f/lib/elm-make-runner.js#L130-L145

halohalospecial commented 5 years ago

Did it work @mrattner ? :slightly_smiling_face:

mrattner commented 5 years ago

Yes, it worked! thanks! :tada:

halohalospecial commented 5 years ago

The changes are in v9.9.3. Thanks!