Recently I was trying to build and publish an Angular library to a private NPM registry using Gitlab CI/CD. The standard Gitlab.com example for publishing an NPM package worked in a clean project, but when applied to my project, it failed. It turns out there were a few things according to issue 247937.
- don’t use a publishConfig in your package.json
- don’t use double quotes (“) when generating the .npmrc file, but single quotes (‘).
The .npmrc file must contain the exact key=value pairs as in the example. thus not the interpolated values…. Took me a day.
Working .gitlab-ci.yaml here.