Coder Social home page Coder Social logo

Comments (23)

alexchandel avatar alexchandel commented on June 22, 2024

For what it's worth, I checked and when I run Option+Shift+C, the final command list it passes to Popen is ["coffee", '-b', '-c', u'/Users/alex/Media/GitHub/sc6-telemetry-code/tel/script.coffee'], which fails somehow. If I run this from the Terminal, it succeeds.

from sublime-better-coffeescript.

aponxi avatar aponxi commented on June 22, 2024

Ok I think I know what is messing this up. Several people have been having similar problems... This has to do with the last commit.

from sublime-better-coffeescript.

aponxi avatar aponxi commented on June 22, 2024

The last commit was done for #26

I have just reverted that. Could you please check now?

#30 is also related to this.

from sublime-better-coffeescript.

alexchandel avatar alexchandel commented on June 22, 2024

I don't think this has anything to do with the last commit, because I'm using the version v2013.01.26.20.45.16, from the Sublime Package Manager. The commit you referred to is almost two months newer. This is a very old issue.

Speaking of the package manager, you should update the version in the Sublime package manager.

from sublime-better-coffeescript.

aponxi avatar aponxi commented on June 22, 2024

Ok I'm looking into this now

from sublime-better-coffeescript.

deepfriedmind avatar deepfriedmind commented on June 22, 2024

Seconded. I'm guessing a lot of people use Homebrew to install Node so a fix would be greatly appreciated.

from sublime-better-coffeescript.

rockwood avatar rockwood commented on June 22, 2024

+1

from sublime-better-coffeescript.

alexchandel avatar alexchandel commented on June 22, 2024

i can help you debug, but remember I'm using the old v2013.01.26.20.45.16. I just want to compile a single standalone coffeescript file, no build system.

Also I noticed a bug that may be related. Every time I run the Build:Run command (which displays a failure report), I notice the path has grown by one "/usr/local/bin:". Repeatedly running the command will add dozens of duplicate "/usr/local/bin:" path elements.

from sublime-better-coffeescript.

aponxi avatar aponxi commented on June 22, 2024

@alexchandel Help would be appreciated...

I believe I added ad function like path resolve to get the absolute path to the file... I think there is an issue there since I think all of this started happening after I added that line.

I'm suggesting that the execution of the command is good but resolving the path to the file has problems, hence getting the "no such file/dir" error. I'm open to suggestions about multiple OS compatible path resolve function(s).

from sublime-better-coffeescript.

alexchandel avatar alexchandel commented on June 22, 2024

Well something is wrong with the path resolution, because it re-appends the path each time. Since we set the binDir variable in a config file, why do we need to find/add the absolute path of the executable every time?

from sublime-better-coffeescript.

alexchandel avatar alexchandel commented on June 22, 2024

I found a partial hardfix. In CoffeeScript.sublime-build, change the path to

"path": "/usr/local/share/npm/bin:/usr/local/bin:$PATH"

This fixes the Build commands, but does nothing for the Compile command. This tells me the binDir path isn't being added to the Build PATH. Incidentally, the node executable is always picked up because homebrew fortunately installs it to /usr/local/bin; however, you should make a separation binDir variable for the node executable.

Also, I have a lead for you on Compile commands. CompileCommand eventually calls run("coffee", ["-c", "/whatever/script.coffee"]). In run, you create the env variable, which messes up the Popen call. I find that changing

proc = Popen(command, env=env, cwd=cwd, stdout=PIPE, stderr=PIPE)

to

proc = Popen(command, cwd=cwd, stdout=PIPE, stderr=PIPE)

makes that snippet runnable when copypasted into the interpreter. The final call ends up being sp.Popen(['coffee', '-c', u'/whatever/script.coffee'], cwd=None, stdout=sp.PIPE, stderr=sp.PIPE), and this executes fine from the interpreter. Note that it fails when the env=env parameter is also set.

However, and I have no idea why, this completely blows up in Sublime Text. When I run Coffee: Compile File, the console says:

Traceback (most recent call last):
  File "./sublime_plugin.py", line 362, in run_
  File "./CoffeeScript.py", line 101, in run
  File "./CoffeeScript.py", line 32, in run
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Even trimming the call down to just Popen(command) doesn't fix it, although this obviously works fine in the command line. I'm absolutely positive that command == ['coffee', '-c', u'/whatever/script.coffee'], so there must be something wrong in the module environment.

I'm really not sure what the problem is with the Compile commands. If you have a potential solution, I can test it, but I strongly recommend you investigate this bug, as it probably affects everyone who installs coffeescript/node with homebrew.

from sublime-better-coffeescript.

jfernandez avatar jfernandez commented on June 22, 2024

+1

from sublime-better-coffeescript.

alexchandel avatar alexchandel commented on June 22, 2024

+1

I persuaded a friend, a recent Sublime Text 2 convert, to try installing CoffeeScript (he first had to install homebrew, then node via homebrew) and sublime-better-coffeescript. He encountered the exact same issue. He'd never used CoffeeScript before (just JS).

This suggests this problem affects everyone who installs node/coffeescript via homebrew.

from sublime-better-coffeescript.

aponxi avatar aponxi commented on June 22, 2024

I hear you guys! I have been busy with a C# project and will fix this as soon as I can take a break from it. In the meantime if you are able to, send a pull request and I would gladly put it in.

Thanks for your interest and I apologize for my absence.

from sublime-better-coffeescript.

mihado avatar mihado commented on June 22, 2024

I kinda fixed the problem by symlink the coffee-script modules from npm directory to /usr/local/bin

ln -sv /usr/local/share/npm/lib/node_modules/coffee-script/bin/coffee /usr/local/bin/coffee
ln -sv /usr/local/share/npm/lib/node_modules/coffee-script/bin/cake /usr/local/bin/cake

from sublime-better-coffeescript.

alexchandel avatar alexchandel commented on June 22, 2024

Hopefully not a permanent fix.

With the current release build, there's now a error: env: node: No such file or directory popup error. Since you use both node and coffee, maybe you should have two binDir variables, one for node and one for coffee? I think there's another ST2 coffeescript plugin that does just that.

from sublime-better-coffeescript.

aponxi avatar aponxi commented on June 22, 2024

Should be fixed now with the new settings. Check the envPATH setting out!

from sublime-better-coffeescript.

zakdances avatar zakdances commented on June 22, 2024

Still can't get this to work. I keep this in my console when I try to enable watch mode:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 255, in on_post_save
    callback.on_post_save(v)
  File "CoffeeScript in /Users/zak/Library/Application Support/Sublime Text 3/Installed Packages/Better CoffeeScript.sublime-package", line 421, in on_post_save
  File "CoffeeScript in /Users/zak/Library/Application Support/Sublime Text 3/Installed Packages/Better CoffeeScript.sublime-package", line 345, in refreshOut
  File "CoffeeScript in /Users/zak/Library/Application Support/Sublime Text 3/Installed Packages/Better CoffeeScript.sublime-package", line 70, in brew
  File "CoffeeScript in /Users/zak/Library/Application Support/Sublime Text 3/Installed Packages/Better CoffeeScript.sublime-package", line 58, in run
  File "X/subprocess.py", line 818, in __init__
  File "X/subprocess.py", line 1416, in _execute_child
FileNotFoundError: [Errno 2] No such file or directory: 'coffee'

In my settings I've tried

"envPATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

and both

"binDir": "/usr/local/bin"

and

"binDir": "/usr/bin"

What's the problem here?

from sublime-better-coffeescript.

aponxi avatar aponxi commented on June 22, 2024

The problem is the plugin cannot find coffee executable. This may not be related to the plugin itself, so let's try to debug this.

  • First let's make sure coffee-script is installed on your OS: Try finding coffee-script in your global npm list with npm ls -g | grep coffee which will output something like
logan@host:~$ npm ls -g | grep coffee
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
├── UNMET DEPENDENCY generator-coffee *
│ │ ├── [email protected]
  • if you would go to terminal and type which coffee it should tell you the path to it:
logan@host:~$ which coffee
/usr/bin/coffee
  • we should make sure the "binDir" in the configuration points to that.

Post your findings and I'll help you debug.

from sublime-better-coffeescript.

zakdances avatar zakdances commented on June 22, 2024

@aponxi Sorry about the delay. I'll be going through your steps later this evening, so I'll report back soon.

from sublime-better-coffeescript.

lavrton avatar lavrton commented on June 22, 2024

Close for now.
@aponxi, please insert info about binDir and which coffee to readme. For example "FAQ" section.

from sublime-better-coffeescript.

zakdances avatar zakdances commented on June 22, 2024

For someone reason my email update didn't show up here. Following Aponxis instructions, it now seems to be working, so thank you @aponxi . It'd be a great addition to the Readme, as lavrton mentions.

from sublime-better-coffeescript.

aponxi avatar aponxi commented on June 22, 2024

You are most welcome @zakdances ! I'm happy to hear that you were able to solve your issue.

@lavrton I will provide more instructions on those.

from sublime-better-coffeescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.