NPM を使用して、coffeescript と shellJS をインストールしました。テスト スクリプト shtest.coffee があります。
#!/usr/local/bin/coffee
require 'shelljs/global'
echo 'hello'
exit 1
コーヒーを使用してスクリプトを実行すると、問題なく動作します。
$ coffee shtest.coffee
hello
または shjs を使用:
$ shjs shtest.coffee
hello
しかし、直接ではありません:
$ chmod u+x shtest.coffee
$ ./shtest.coffee
./shtest.coffee: line 2: require: command not found
hello
シバンを指すように変更し/usr/local/bin/js
ても役に立ちません。
スクリプトは bash スクリプトとして実行されているようです。私は何を間違っていますか?OS X Snow Leopard。