Artifactory virtual / remote / local repo confusion in CI
Artifactory has three repo kinds with distinct roles: local repos hold your artifacts, remote repos proxy external ones, and virtual repos aggregate both for resolution. Using the wrong kind for deploy or resolve fails.
What this error means
A deploy to a virtual or remote repo is rejected (often "Cannot deploy to a virtual repository"), or a resolve from a local-only repo misses proxied dependencies.
[Error] server response: 400 Bad Request
Cannot deploy to a virtual repository 'libs-virtual'. Deploy to a local repository instead.Common causes
Deploying to a virtual or remote repo
Virtual repos are for resolution and remote repos proxy upstreams; neither accepts direct deploys, so the write is refused.
Resolving only from a local repo
Pointing installs at a local repo misses dependencies that a virtual repo would pull from remote proxies.
How to fix it
Deploy to local, resolve through virtual
- Set the deploy target to a local repository.
- Set the resolve source to a virtual repository that aggregates local plus remote.
- Re-run so writes and reads use the right repo kind.
jf npm-config --repo-resolve npm-virtual --repo-deploy npm-localConfirm repo kinds before wiring CI
List repositories to see which are local, remote, or virtual and route deploy and resolve accordingly.
jf rt curl -XGET "/api/repositories" | jq '.[] | {key, type}'How to prevent it
- Always deploy to local repos and resolve through virtual repos.
- Never target remote or virtual repos for a deploy.
- Name repos by kind (local/remote/virtual) to avoid mixups.