'nx command not found on gitlab-runner

I have installed nx globally using Sudo

sudo npm install -g nx

and it works fine, but sometimes it gives the below error

bash: line 136: nx: command not found

After retry, it works fine again.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source