[Buildroot] [v2 4/6] package/nodejs: Add /usr/lib/node_modules/.bin to PATH

Martin Bark martin at barkynet.com
Mon Jun 29 19:31:59 UTC 2015


Yann,

On 29 June 2015 at 18:20, Yann E. MORIN <yann.morin.1998 at free.fr> wrote:
> Martin, All,
>
> On 2015-06-29 10:13 +0100, Martin Bark spake thusly:
>> Yes I agree your way is easier to read, I'll update my patch and resubmit it.
>
> Great, thanls! :-)
>
>> The reason this is useful is because there lots of node.js packages
>> that are normal command line apps designed to be installed globally.
>> For example, if you install http-server
>> (https://github.com/indexzero/http-server) then you simple need to cd
>> into any directory, type ./http-server and it will server that
>
> You mean, http-server must be in the directory you want to serve? Or did
> you mean that you just run /path/to/http-server and it will serve the
> current directory?  (I guess the latter.)

Yes i meant the latter

>
>> directory up for you.  Another example might be vtop
>> (https://github.com/MrRio/vtop), a graphical version of top.
>>
>> If you install these apps globally then all the executables will be in
>> the /usr/lib/node_modules/.bin directory.  So this patch simply saves
>> you typing the full path, the same as for your desktop.
>
> OK, so why not make symlinks (or hadlinks) for each of them in /usr/bin
> instead? Something like (untested):
>
>     cd $(TARGET_DIR)/usr/bin; \
>     for f in ../../usr/lib/node_modules/.bin/*; do \
>         [ -f "$${f}" -a -x "$${f}" ] || continue; \
>         ln -sf "$${f}" "$${f##*/}" || exit 1; \
>     done
>

OK i can see that working too and it saves adjusting PATH.  I'll send
an updated patch using your method.

Thanks

Martin


More information about the buildroot mailing list