ARTIFACTORY: Resolving Deployment Failures to NPM Local Repositories Due to Policy Configuration

ARTIFACTORY: Resolving Deployment Failures to NPM Local Repositories Due to Policy Configuration

Products
Frog_Artifactory
Content Type
Use_Case
AuthorFullName__c
Zhang Hailang
articleNumber
000006800
FirstPublishedDate
2025-12-29T08:00:36Z
lastModifiedDate
2025-12-29
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.

User-added image 

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
  1. 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"
  2. Deployment Verification: Re-run the previously failed deployment operation (e.g., deploying jenkins-1.1.0.tgz). It should now complete successfully.