Resolution:

ARTIFACTORY:How to fix “error code 400: Rejected artifact download request: Parent “package-name”/- must be a folder”

AuthorFullName__c
Derek Pang, Mohammad Tibi
articleNumber
000004031
ft:sourceType
Salesforce
FirstPublishedDate
2017-08-28T17:34:38Z
lastModifiedDate
2024-03-10T07:49:25Z
VersionNumber
6
The solution for this matter is to locate the offending file and remove it manually. In Artifactory 7.23.3 and later a fix was introduced with RTFACT-23455 that resolves this issue. If you encounter the 400 error, Zap the Cache of the remote repository and run the NPM request again with the ‘/api/npm’ prefix.

To locate the file find the path that the error indicates.
For example:
2023-11-14T19:01:34.854Z [jfrt ] [ERROR] [5eeb60ad487f9d6e] [o.a.r.HttpRepo:1412           ] [http-nio-8081-exec-7] - npm-npm-remote: Failed to download 'https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz'. Received status code 200 and caught exception: Parent lodash/- must be a folder
2023-11-14T19:01:34.870Z [jfrt ] [WARN ] [5eeb60ad487f9d6e] [.r.ArtifactoryResponseBase:125] [http-nio-8081-exec-7] - Sending HTTP error code 400: Rejected artifact download request: Parent lodash/- must be a folder

The error indicates that in the root location “lodash” is a file when the request is expected it is supposed to be a folder.

User-added image
You can remove this file and then try to resolve the package again.

Note: After deleting the file, make sure to pay attention that the requests are not missing the ‘/api/npm/’ prefix in the URL, and you should not get this error again.