pkg prime-list

I have just run pkg prime-list on two FreeBSD 12.1-RELEASE systems and it works OK on one, but am told 'unknown command' on the other.

How do I go about making this command work on the other?
See also pkg.conf(5) and pkg-alias(8); local aliases defined in /usr/local/etc/pkg.conf

If you do not know that prime-list in pkg prime-list is a local alias for use with pkg, it is rather difficult to find the right information. apropos prime-list does not give usefull hints.

While pkg(8) does mention the subcommand alias, you might not realise that prime-list is a local alias. The subcommand help points you in the right direction:
% pkg help prime-list
`prime-list` is an alias to `query -e '%a = 0' '%n'`