We have a npm repository inside our nexus, and we want to remove some artifact versions from it.
we do it with a script to select which artifact deletes.
The artifacts were deleted correctly and when you browse the repository the artifacts do not exist.
but when you download the metadata of a specific artifact the deleted versions are still present
we have various time “Repair - Rebuild npm metadata” Tasks but this does not fix the problem
How we could clean the npm metadata?
We are using Nexus OSS 3.61.0-02
If this is a proxy repository? If it is then that would be normal and expected as the metadata would reflect the remote.
For hosted repositories you should ensure you’re not using cached metadata - both browsers and the npm client will cache these files. So you should ensure that you’re clearing those caches when verifying metadata.
is an hosted repository.
the metadata file with the old version is not cached, we download it directly from the nexus without any cache to check it, and contains the deleted artifacts.
the problem could be that the script deletes it directly from the storage and probably the metadata is corrected, we need a way to regenerate the metadata checking the artifact that are present in the storage
Yes, that’s the problem. Nexus Repository maintains a list of components it’s managing inside an embedded database; if you just modify storage, Repo still thinks it has that binary until it tries to serve it (at which point you get 500 errors). Better to delete the components through the REST API or one of the format APIs.
What logic are you using to choose what should be deleted?
We have snapshots and releases mixed in the same repository, we create 2 repositories one for snapshots and one for releases, and try to remove the snapshot artifacts from the releases based on the version. Is there a way to regenerate the DB based on the artifact present in the storage?