Did you already take a look at the following article?
How to connect over the internet to NoMachine behind a NAT router
https://kb.nomachine.com/AR10R01099
“Failed to map the port on gateway” suggests that the port you used in the port-forwarding rule on your router could already already be in use. Go back to your router and change the external port number to something else, then restart the nxserver (NoMachine settings -> Server -> Status -> Restart) . For safe measure also restart UPnP.
Is it possible there is a double NAT in place? If so, you will need to map the ports on both routers. So Router A must map to Router B and Router B to the computer you want to access.