Reputation: 435
I am trying to run npm publish
on a package after I've upgraded to node v18
and npm v9
.
But I get the following error:
This command requires you to be logged in to https://some-package.com:48082/nexus/repository/path1/
You need to authorize this machine using npm adduser
My user .npmrc
file:
//some-package.com:48082/nexus/repository/:keyfile=/Users/<host>/Documents/Certificates/npm.key.pem.
//some-package.com:48082/nexus/repository/:certfile=/Users/<host>/Documents/Certificates/npm.crt.pem
//registry.npmjs.org/:_authToken=<auth_token>
My project .npmrc
file:
@fortawesome:registry=https://npm.fontawesome.com/.
@scope1:registry=https://some-package.com:48082/nexus/repository/path1/
@scope2:registry=https://some-package.com:48082/nexus/repository/path2/
//npm.fontawesome.com/:_authToken=<auth_token>
//some-package.com:48082/nexus/repository/:_auth=<auth>
strict-ssl=false
Upvotes: 7
Views: 22479
Reputation: 435
The fix for this issue is that we need to add the certificate and key files in the global .npmrc
on repo level, not on the nexus level:
//some-package.com:48082/nexus/repository/path1/:keyfile=/Users/<host>/Documents/Certificates/npm.key.pem
//some-package.com:48082/nexus/repository/path1/:certfile=/Users/<host>/Documents/Certificates/npm.crt.pem
//some-package.com:48082/nexus/repository/path2/:keyfile=/Users/<host>/Documents/Certificates/npm.key.pem
//some-package.com:48082/nexus/repository/path2/:certfile=/Users/<host>/Documents/Certificates/npm.crt.pem
Same for the project .npmrc
:
//some-package.com:48082/nexus/repository/path1/:_auth=<auth>
//some-package.com:48082/nexus/repository/path2/:_auth=<auth>
Upvotes: -1
Reputation: 4694
To publish a package to NPM you need to login to the NPM registry. Here are a few steps to do that-
npm adduser
npm login
npm whoami
npm run build-library
npm publish --access public
Upvotes: 2