Skip to content

npm, pnpm, Yarn ​

Activate the npm Bearer Token Realm first. Then:

shell
npm config set registry https://astrum.example.com/repository/npm-group/
npm login --registry=https://astrum.example.com/repository/npm-group/ --auth-type=legacy

npm login stores a token in ~/.npmrc. For CI write a token directly, an npm token or an access token:

ini
registry=https://astrum.example.com/repository/npm-group/
//astrum.example.com/repository/npm-group/:_authToken=${NPM_TOKEN}
//astrum.example.com/repository/npm-hosted/:_authToken=${NPM_TOKEN}

and publish with npm publish --registry=https://astrum.example.com/repository/npm-hosted/, or set publishConfig.registry in package.json. A token for a user can also be requested without a browser:

shell
curl -X PUT -H 'Content-Type: application/json' \
  -d '{"name":"ci-npm","password":"…"}' \
  https://astrum.example.com/repository/npm-hosted/-/user/org.couchdb.user:ci-npm

Released under the MIT License.