Introduction
This document addresses the 409 conflict error that occurs when deploying *.tgz packages to an Artifactory NPM local repository due to incorrect repository policy configuration.
Error Symptoms
The deployment operation fails, and the following key error appears in the artifactory-service.log:
The repository ‘zhl-npm-local‘ rejected the resolution of an artifact ‘zhl-npm-local:jenkins/-/jenkins-1.1.0.tgz‘ due to conflict in the snapshot release handling policy.
Resolution
Steps: Correcting Configuration via REST API
Execute the following CURL command to set the deployment policy of the target repository (using zhl-npm-local as an example) to an allowed state.
Prepare the Command: Replace the variables in angle brackets with actual values.
- <ADMIN_USER>:<PASSWORD>: Administrator username and password.
- <ARTIFACTORY_HOST>:<PORT>: Artifactory service address and port.
Execute the API Call:
bash
curl -X POST -u <ADMIN_USER>:<PASSWORD> \
-H "Content-Type: application/json" \
-d '{
"rclass": "local",
"packageType": "npm",
"handleReleases": true,
"handleSnapshots": true
}' \
"http://<ARTIFACTORY_HOST>:<PORT>/artifactory/api/repositories/zhl-npm-local"
Core Configuration Note: For NPM local repositories, {"handleReleases": true, "handleSnapshots": true} is the recommended and necessary configuration combination to ensure the repository can accept NPM packages of various versions.
Verification - Query Verification: Execute the following command and confirm in the returned JSON that the values for both handleReleases and handleSnapshots have been updated to true.
curl -u <ADMIN_USER>:<PASSWORD> \
"http://<ARTIFACTORY_HOST>:<PORT>/artifactory/api/repositories/zhl-npm-local"
- Deployment Verification: Re-run the previously failed deployment operation (e.g., deploying jenkins-1.1.0.tgz). It should now complete successfully.