On RHEL I have put various executable files in ~/.local/bin
eg. nvim.appimage. As ~/.local/bin
is in my $PATH variable I can call nvim.appimage from any directory which is great.
I want some node apps to be able to be called from any directory, for example ESLint. These are not binaries but are directories with a lot of files and directories inside. Which directory (presumably in $PATH) should they be in so that I as a user but not other users can call them from any of my directories? Also how should they be invoked.
As an example, I have put the cowsay node app into ~/.local/bin I can invoke it like this from any of my directories:
$ node ~/.local/bin/cowsay/node_modules/cowsay/cli.js moo
(I can actually omit node from that command as cli.js has #!bin/bash/env node
at the top.)
I would like to be able to invoke cowsay from any of my directories with a simple command eg cowsay
I know that a lot of node apps are not intended to be run from the command line but some are. In particular I am having great difficulty to get neovim with Ale to recognize some node linters like ESLint. Perhaps if I can sort the cowsay issue out I may be able to move on to ESLint with neovim. I am hoping that if I can get ESLint invokable from a location in $PATH it might be usable by neovim / Ale.
CodePudding user response:
Can this achieve what you expected ?
mkdir ~/.local/nodexe
cd ~/.local/nodexe
ln -fs ../bin/cowsay/node_modules/cowsay/cli.js cowsay
PATH=$PATH:~/.local/nodexe
Assuming you have #!bin/bash/env node
in cli.js, then you can run by typing cowsay moo