SublimeText / CoffeeScript

Syntax highlighting and checking, commands, shortcuts, snippets, watched compilation and more.
439 stars 64 forks source link

/usr/bin/env: node: No such file or directory #217

Open binarykitchen opened 9 years ago

binarykitchen commented 9 years ago

Whenever I hit ALT-SHIFT-D to compile into JS, sublime shows me that above error:

/usr/bin/env: node: No such file or directory

But I already have the binDir specified in CoffeeScript.sublime-settings:

"binDir": "/home/michael-heuberger/npm/bin/"

which is correct because of:

$ which coffee
/home/michael-heuberger/npm/bin/coffee

And it's installed:

$ npm ls -g | grep coffee
├── coffee-script@1.9.3
└─┬ coffeelint@1.10.1
  ├── coffee-script@1.9.3

Using latest iojs here

$ iojs -v
v2.2.1

Any clues what's wrong?

markalfred commented 9 years ago

This stackoverflow answer will likely be your solution. If you look at the top of your /home/michael-heuberger/npm/bin/coffee file, you should see the line

#!/usr/bin/env node

This is where the /usr/bin/env: node error is coming from.

One other potential issue:

Some OS's may refer to the node bin as nodejs. If that's the case, you should be able to run which nodejs and then symlink /usr/bin/node to that in the manner described in the stackoverflow above. Let me know if this helps!

binarykitchen commented 9 years ago

Yes, I've read these discussions too but no luck.

Already have everything here and looks correct:

$ which node
/usr/bin/node
$ /usr/bin/env node
> 
(^C again to quit)
> 

Any other suggestions?

binarykitchen commented 9 years ago

Also when I run that coffee script directly, it works:

# michael-heuberger at M2 in ~/npm/bin [9:25:35]
$ ./coffee
coffee> 
(^C again to quit)
coffee> 

# michael-heuberger at M2 in ~/npm/bin [9:25:39]
$ cat coffee
#!/usr/bin/env node

var path = require('path');
var fs   = require('fs');
var lib  = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');

require(lib + '/coffee-script/command').run();

# michael-heuberger at M2 in ~/npm/bin [9:25:50]
$ ./coffee
coffee>