nx command not found on gitlab-runner

Viewed 1134

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.

1 Answers

Check first if adding nrwl/cli would help, as shown here:

sudo npm i -g @nrwl/cli

And check if, in case of error, the $PATH value as seen in the GitLab runner, to understand why it would not see nx.
Using npm run nx as an alternative to nx coud be a workaround in that case.

Related