Run the following commands:

npm config set registry https://my_nexus_server/repositories/npm/
npm config set strict-ssl false
npm config set always-auth true
npm config set _auth bXktdXNlcjpteS1wYXNzd29yZA==

Generate the base64 as follows (don't forget the -n otherwise the newline character will be added to the base64 string:

echo -n 'my-user:my-password' | openssl base64

Alternatively you can just create a ~/.npmrc file as follows:

registry=https://my_nexus_server/repositories/npm/
strict-ssl=false
always-auth=true
_auth="bXktdXNlcjpteS1wYXNzd29yZA=="

NOTE: any config keys starting with an underscore are hidden, therefore they will not be echoed to the screen when running  npm config --list