nibblebot/sublime-js2coffee

/bin/sh: js2coffee: command not found

adilwali opened this issue · 14 comments

Hopefully I am not adding a duplicate here -- I went through the previously closed issues and didn't see anything that looked the same.

I have installed:

  • node and npm (js2coffee requires these)
  • js2coffee and coffee-script: npm install -g js2coffee coffee-script

And I've installed the Package for Sublime Text via the Package Control. All seemed to go fine. But when I actually run the command to convert something to coffee (via package control), I get this in the output:
/bin/sh: js2coffee: command not found

But I can run 'js2coffee' fine from console. I used brew to install it, so it's at: /usr/local/lib/node_modules/js2coffee

Any ideas?

  1. do you have it symlinked in /usr/local/bin/js2coffee ?
  2. OSX uses a weird PATH env for GUI applications that is different from PATH
    e.g.
    compare echo $PATH to launchctl getenv PATH
    also see: http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x

I'll have to see how other plugins are handling it to be more robust, I might have to hardcode the path if user is on OSX...

Hey,

I'm on Mac OS X 10.8.2 and tried all the methods in the stackoverflow link but could not make it work.
Can you pls help..

I get the same error. I have Node/NPM installed through Homebrew and js2coffee is in /usr/local/share/npm/bin/. I symlinked js2coffee in /usr/local/bin/. I then got the error env: coffee: No such file or directory. After symlinking coffee in to /usr/local/bin/ as well, I get the following:

TypeError: Cannot read property 'length' of undefined
  at /usr/local/share/npm/lib/node_modules/js2coffee/lib/helpers.coffee:118:29
  at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/js2coffee/lib/helpers.coffee:125:5)
  at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/js2coffee/lib/helpers.coffee:162:4)
  at Module._compile (module.js:456:26)
  at Object.loadFile (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:179:19)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/js2coffee/lib/js2coffee.coffee:13:36)
  at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/js2coffee/lib/js2coffee.coffee:1127:4)
  at Module._compile (module.js:456:26)
  at Object.loadFile (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:179:19)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/js2coffee/lib/command.coffee:4:15)
  at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/js2coffee/lib/command.coffee:234:4)
  at Module._compile (module.js:456:26)
  at Object.loadFile (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:179:19)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/js2coffee/bin/js2coffee:7:1, <js>:10:3)
  at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/js2coffee/bin/js2coffee:12:4)
  at Module._compile (module.js:456:26)

Any ideas?

Have the same problem. (Compiling coffeescript in sublime reports the same error, too, but with coffee reported missing instead of js2coffee.)

> which js2coffee
/usr/local/bin/js2coffee

But in Sublime, I get:

/bin/sh: js2coffee: command not found

I’ll try reading the link about GUI apps’ PATHs.

I updated my PATH via launchctl setenv PATH and verified (via getenv) it now contains /usr/local/bin, but after restarting Sublime Text, I still get the same error:

/bin/sh: js2coffee: command not found
olih commented

Same issue ...js2coffee in /usr/local/bin/js2coffee (MacOs 10.6) ...

Same here. OSX 10.8.3

Same issue here:

ST2:

/bin/sh: js2coffee: command not found

My terminal output:

$ which js2coffee
/usr/local/bin/js2coffee

One thing to consider might be to set the path on a user preferences level like they do in Sublime Coffee Compile. Just a thought. Does anyone have this working? I'd love to see this come into play 👍

Hey all fellow Mac guys, install this great plugin from int3h to fix this issue. https://github.com/int3h/SublimeFixMacPath

@justinhernandez Wow, that fix worked instantly! Thank you, my man!

@andrewmartin don't thank me! Thank @int3h! 👍

Thank you @int3h! 👍

@andrewmartin @justinhernandez No problem, glad my little plugin could help :) This is exactly the type of thing I created it for.