Hey! Loving termux!
I'm a node.js developer and I just tried installing a npm module globally (-g or --global) and it installs just fine but when I go to use the module it gives an error:
npm i trymodule -g
$ trymodule colors
-bash: /data/data/com.termux/files/usr/bin/trymodule: /data/data/com.termux/files/usr/bin/env: bad interpreter: No such file or directory
However when I execute the module from the bin with node it works.
$ node /data/data/com.termux/files/usr/bin/trymodule colors
Any idea why I can't just call the global executable that npm installs?
When I go into these bin files for instance cat /data/data/com.termux/files/usr/bin/trymodule I see that the first line is rewritten from #!/usr/bin/env node to:
#!/data/data/com.termux/files/usr/bin/env node
Which is really odd.
The rewriting of #!/usr/bin/env node to #!/data/data/com.termux/files/usr/bin/env node is done since /usr does not exist on Android.
This is done by a patch to npm which invokes termux-fix-shebang on the installed programs in bin/.
The problem is that $PREFIX/bin/env is not installed by default - you can solve this by installing coreutils (which provides this file) with
apt install coreutils
There is an issue about $PREFIX/bin/env not being installed by default at #125, so closing this in favour of that one.
Hello, i have the same problem and i tried
apt install coreutils
But if no use.
Any help is appreciated. Thanks
Actually, it works with npm but not with yarn.
Thanks. Problem solved.
Most helpful comment
The rewriting of
#!/usr/bin/env nodeto#!/data/data/com.termux/files/usr/bin/env nodeis done since/usrdoes not exist on Android.This is done by a patch to npm which invokes termux-fix-shebang on the installed programs in bin/.
The problem is that
$PREFIX/bin/envis not installed by default - you can solve this by installing coreutils (which provides this file) withThere is an issue about
$PREFIX/bin/envnot being installed by default at #125, so closing this in favour of that one.