Sources: https://help.sonatype.com/repomanager3/nexus-repository-administration/formats/npm-registry/npm-security
& https://help.sonatype.com/repomanager3/nexus-repository-administration/formats/npm-registry/publishing-npm-packages
-
Configure registry (its important doing this before configuring the authentication in step 2, because the authentication settings will be based on the registry):
npm config set registry=”http://localhost:8081/repository/npm-internal/”
-
Configure authentication using a line like the following example:
npm config set _auth=”$(echo -n ‘username:password’ | base64)”
-
Check the current configuration using the following:
npm config ls
-
Publish your npm package:
npm publish –registry http://localhost:8081/repository/npm-internal/