DEV Community

Jim Burbridge
Jim Burbridge

Posted on • Updated on

[Request For Post] Your solution for auto publishing NPM packages?


I recently created an NPM module that while it's not hugely popular, has more downloads than I thought it would. I have a CI/CD setup on my gitlab to lint, test, generate a changelog, and publish.

Three of those jobs work. Take a guess at which 3? That's right, linting, testing, and changelog-ing all work.

All of the places I've found mention of CI/CD with Gitlab and NPM boils down to the following:

  1. Either run npm config set registry // ${NPM_TOKEN} and then running npm publish OR
  2. doing basically the same thing, but instead adding the //${NPM_TOKEN} to a local .npmrc file.

I've tried both of these on my WSL Ubuntu install. Neither has worked.

I found this Stack Overflow post, and in digging through some links found someone who recommended setting strict-ssl to false. I can't say I'm comfortable with that.

How do YOU do it?

Most of the time my CI/CD stuff pertains to servers, not necessarily NPM modules, so I'm a little out of flavor here. I figure there has to be some way to do this without turning off SSL? I'm holding off on updating my pipeline in the hopes that maybe there's something I missed in all my searching.

Top comments (0)