Kristof Komlossy
Kristof Komlossy

Reputation: 653

NPM Cache does not invalidate for private packages in Gitlab

I have a self hosted Gitlab with multiple private packages in the registry.

My .npmrc looks like this:

@custom-scope:registry=https://example.com/api/v4/projects/5/packages/npm/
//example.com/api/v4/projects/5/packages/npm/:_authToken="secret"

Publishing packages works flawlessly, the new versions are downloadable from gitlab and also the manifest at https://example.com/api/v4/projects/5/packages/npm/<some-package> contains the new version.

But my local npm does not recognize new versions.
I always have to call npm cache clear -f before an installation.

npm show <some-package does also not show the latest version.
Even if I try to install the specific new version I get an 404 Error.
Inspecting the npm logs it tries to pull the new version from gitlab and even prints the URL in the logs. If I call this URL the package is downloaded from the browser.
Why is npm not able to see the new version?

I couldn't find any solutions on the internet yet.

Upvotes: 0

Views: 57

Answers (1)

Adrian
Adrian

Reputation: 1

I'm pretty sure this is related to Gitlab responding with a 304 when npm requests the package metadata. There is an unresolved bug report from two years ago.

Upvotes: 0

Related Questions