Coffeescript executable doesn't follow symlinks when looking up require()'d packages
josephg opened this issue · 2 comments
Lets say I have a package:
main.coffee
node_modules/coolstuff
main.coffee:
require 'coolstuff'
# ...
I can run this module using coffee main.coffee
and it works.
If I instead make a symlink to main.coffee from somewhere else and run coffee mysymlink.coffee
it doesn't work, because it can't find the coolstuff module.
This isn't the case with nodejs - if you write the equivalent javascript, symlink it and run it with node mysymlink.js
it works.
Npm installs package binaries this way. On my machine, /usr/local/bin/myscript
is a symlink to /usr/local/lib/node_modules/mylibrary/myscript
. The script can't find the library's dependancies because its not looking for them in the library's node_modules directory.
related: satyr/coco@afdc975
The coffee
command is intended primarily for compiling and debugging, not as a replacement for node
. A patch for this would be welcome, but we don’t plan to try to support all the edge cases that node
supports.