For my project, I am trying to install (not publish!) a npm package from GitHub Packages. It is hosted on a private repository, which is in an org. I have made a personal access token with the required permission to read from that repo and org. All of this works locally with the following steps:
- Set the registry in the
.npmrcfile:registry=https://npm.pkg.github.com/OWNER - Terminal login:
npm login --registry=https://npm.pkg.github.comIt will then prompt this:
> Username: USERNAME
> Password: TOKEN
> Email: PUBLIC-EMAIL-ADDRESS
Usernameis your standard github usernameTokenis the personal access token created with the right permissionsEmailcan be random
After filling out, everything works and i can install the packge, alongside all the others hosted on the normal npm registry.
Now onto the problem: I am trying to replicate the same on circleCI, but it doesnt seem to let me override the npm registry. The project includes a .npmrc file in the same folder that the package.json is located at. Here is part of the circle ci conf:
- run:
name: "Set NPM registry"
command: npm config set registry https://npm.pkg.github.com/OWNER
- run:
name: "Authenticate with GitHub package registry"
command: echo "//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGES}" > web_ui/frontend/.npmrc
- run:
name: "Install frontend dependencies"
command: npm run deps-frontend
GITHUB_PACKAGES is just an env variable stored in circleCI.
Now the error message tells me the following:
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="GitHub Package Registry"
I tried googling for it, but nothing that worked came up.