clemos / haxe-sublime-bundle

Sublime Text bundle for Haxe programming language
Apache License 2.0
237 stars 86 forks source link

[Errno 2] No such file or directory #117

Closed mikomize closed 10 years ago

mikomize commented 10 years ago

i have got haxe installed via homebrew and ive set settings in sublime:

{ "haxe_path": "/usr/local/opt/haxe/bin/haxe", "haxe_library_path": "/usr/lib/haxe/lib/" }

and while trying to build project im getting error:

[Errno 2] No such file or directory [cmd: [u'haxe', u'build.hxml']] [dir: /Users/miko/projects/haxenode] [path: /usr/bin:/bin:/usr/sbin:/sbin] [Finished]

typing "/usr/local/opt/haxe/bin/haxe build.hxml" in console works fine. What am i doing wrong?

clemos commented 10 years ago

It seems you're using ST build (normally Ctrl+B / F7). You need to make sure you're in an .hx file. On some installations, some of the bundle's shortcuts are overriden by ST, so you may need to copy them from this file : https://github.com/clemos/haxe-sublime-bundle/blob/master/Support/Default.sublime-keymap to your user key bindings preference file (Preferences > Key Bindings - User)

DanielHudson commented 10 years ago

Hi,

I'm having the same issue with ST3, OSX Mavericks & homebrew.

CTRL+Shift+B Brings up the build selection as expected, but CTRL+Enter gives the following output...

[Errno 2] No such file or directory: 'haxelib'
[cmd: ['haxelib', 'run', 'openfl', 'test', 'project.xml', 'neko', '-64', '-debug']]
[dir: /Users/username/Documents/haxe/DisplayingABitmap]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
[Finished]

The path above doesn't reflect what I have in my ~/.profile path, nor in /etc/paths...

I managed to get it working by making symlinks pointing to haxe/haxelib and neko in the /usr/bin dir...

I should probably also mention that I tried the shortcuts mentioned above by Clemos, but they didn't make any noticable difference to me.

mikomize commented 10 years ago

Solution that worked for me:

uninstall homebrew haxe.

install haxe manually from repo.

also, for long time autocomplete didnt work for me, it took me long time to solve it since there wasnt any useful error shown in console.

my build.hxml looked like that: -js Server.js -main Server -lib minject nodejs -D minject nodejs

and thats valid build.hxml file for haxe, but for some reasons i had to change it to: -js Server.js -main Server -lib minject -D minject -lib nodejs -D nodejs to make sublime plugin autocomplete works.

clemos commented 10 years ago

I didn't know it was possible to add several libs or defines after -lib or -D... I think this is really an edge case, I'll look into escaping / splitting these arguments properly if I have some time... Meanwhile, and I think more generally, you'd better have one argument per flag.

slaskis commented 10 years ago

The problem is that OSX GUI applications does not get the env PATH unless you open the app from the command line. They use a special built in PATH set from launchd.

And since mavericks they also removed /usr/local/bin from that built in path so that's why the homebrew haxe binary cannot be found. But /usr/bin is still there which is why I think the installer works.

This little workaround updates the GUI env PATH with the one you might have set in your shell but I need to figure out a way for it to be run automatically on boot, now after a reboot you have to run it again:

launchctl setenv PATH $PATH
killall Dock && killall SystemUIServer && killall Finder
clemos commented 10 years ago

You should be able to set the path to the haxe executable through your ST settings, see : https://github.com/clemos/haxe-sublime-bundle#settings (haxe_path, you'll probably need to restart ST after that) I haven't really tested that much, so don't hesitate to open other issues in case it doesn't work

slaskis commented 10 years ago

@clemos That setting only fixes the haxe binary. Not haxelib which @danielhudson had problems with above. Maybe it could be a haxe directory instead of pointing to the binary?

clemos commented 10 years ago

Right. I'll add another setting, then (to avoid breaking other people's settings...)

DanielHudson commented 10 years ago

I've just set up a new laptop and added "haxe_path": "/usr/local/bin/" & "haxe_library_path": "/usr/local/bin/" added into my Settings - User in ST3... Still getting the same output as above.

@slaskis thanks for GUI info, I wasn't aware that that the GUI didn't get the PATH...

I made some symlinks again...

clemos commented 10 years ago

haxe_path should be the full path to the executable, so probably /usr/local/bin/haxe and haxe_library_path should most probably end with std...

slaskis commented 10 years ago

@danielhudson no problem, I was stumped about this recently myself...

DanielHudson commented 10 years ago
"haxe_path": "/usr/local/Cellar/haxe/3.1.3/bin/haxe",
"haxe_library_path": "/usr/local/Cellar/haxe/3.1.3/lib/haxe/std"

FYI, still not working when i hit CTRL + Enter, same error... Not that fussed since it's easy to just make symlinks in /usr/bin anyway...

clemos commented 10 years ago

Yeah I still haven't added the haxelib_path config variable :S

clemos commented 10 years ago

I think symlinks are better, though, because if haxelib is run by the haxe executable, I don't think I'll be able to override its path...

clemos commented 10 years ago

I've added an haxelib_path variable, let me know how it goes ;)

DanielHudson commented 10 years ago

In ST3, it all works great so far - with symlinks removed... Many thanks!!!!

clemos commented 10 years ago

Closing this issue. I don't think I'll fix the "second" one from @mikomize (related to several lib / flags per single -D or -lib) but feel free to create yet another issue for that, if you believe it's critical :p

Gaen commented 9 years ago

Sublime native build is still not working on OSX because of homebrew and $PATH stuff, and I don't want to fix it through messing with os settings. So I hacked the package itself:

Because I can. Worked like a charm.