google / zx

A tool for writing better scripts

Home Page:https://google.github.io/zx/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should we add a PATH warning notice ?

IfnotFr opened this issue · comments

I think It may be usefull to add a notice in the documentation or in the readme for informing users that a valid PATH is required on the current env while uzing zx.

For example, zx my-script.mjs is working out of the box in terminal, but if you are trying to call zx scripts from a systemd service, or dhcpcd run hooks (in my particular case) the PATH may be not available and neither node and zx may be found.

I think this can be a common case and can bring misconfusion to beginner / average linux users like me.

SOLUTION

Add a new block like this on the readme (this is a first shot and may be not fully corect, improvements are welcome) :

Troubleshooting

My script is not running from systemd service or other background-related context.

Make sure your PATH environment variable of your service/script has the npm bin folder. If you cant set the PATH, you can also make symlinks of node and zx to a binary folder:

sudo ln -s $(which node) /usr/local/bin/node
sudo ln -s $(which zx) /usr/local/bin/zx

Well. This is pretty basic Linux 101. I think we don't need this in the readme.

commented

Thank you @IfnotFr for this and I agree this would be useful even if it is basic. It would seem to be a common thing that would come up with a tool like this. Its not like this takes up much space in the readme if that is a concern.