'JFrog: how to remove a version of an npm package?

Used this command and it returns 200:

npm unpublish myapp@"0.1.23" --verbose --registry https://myapp.jfrog.io/artifactory/api/npm/myapp/

Log:

 $ npm --force unpublish myapp@"0.1.23" --verbose --registry https://myapp.jfrog.io/artifactory/api/npm/myapp/
npm verb cli [
npm verb cli   '/home/me/.nvm/versions/node/v12.16.0/bin/node',
npm verb cli   '/home/me/.nvm/versions/node/v12.16.0/bin/npm',
npm verb cli   '--force',
npm verb cli   'unpublish',
npm verb cli   '[email protected]',
npm verb cli   '--verbose',
npm verb cli   '--registry',
npm verb cli   'https://myapp.jfrog.io/artifactory/api/npm/myapp/'
npm verb cli ]
npm info using [email protected]
npm info using [email protected]
npm timing config:load:defaults Completed in 1ms
npm timing config:load:file:/home/me/.nvm/versions/node/v12.16.0/lib/node_modules/npm/npmrc Completed in 1ms
npm timing config:load:builtin Completed in 1ms
npm timing config:load:cli Completed in 2ms
npm timing config:load:env Completed in 0ms
npm timing config:load:file:/home/me/d/altinn-studio/.npmrc Completed in 1ms
npm timing config:load:project Completed in 1ms
npm timing config:load:file:/home/me/.npmrc Completed in 0ms
npm timing config:load:user Completed in 0ms
npm timing config:load:file:/home/me/.nvm/versions/node/v12.16.0/etc/npmrc Completed in 0ms
npm timing config:load:global Completed in 0ms
npm timing config:load:cafile Completed in 0ms
npm timing config:load:validate Completed in 1ms
npm timing config:load:setUserAgent Completed in 0ms
npm timing config:load:setEnvs Completed in 0ms
npm timing config:load Completed in 6ms
npm WARN using --force Recommended protections disabled.
npm verb npm-session f8603b074437ff3e
npm timing npm:load Completed in 14ms
npm http fetch GET 304 https://myapp.jfrog.io/artifactory/api/npm/myapp/myapp?write=true 405ms (from cache)
npm http fetch PUT 200 https://myapp.jfrog.io/artifactory/api/npm/myapp/myapp/-rev/1-0 198ms
npm http fetch GET 304 https://myapp.jfrog.io/artifactory/api/npm/myapp/myapp?write=true 71ms (from cache)
npm http fetch DELETE 200 https://myapp.jfrog.io/artifactory/api/npm/myapp/artifactory/api/npm/myapp/myapp/-/myapp-0.1.23.tgz/-rev/1-0 45ms
- [email protected]
npm timing command:unpublish Completed in 733ms
npm verb exit 0
npm timing npm Completed in 853ms
npm info ok 
 ~/myapp

But the package version is not gone from the UI. When I remove it from UI, the version is removed and the removed version is not listed when I do npm v myapp versions --registry https://myapp.jfrog.io/artifactory/api/npm/myapp/.



Solution 1:[1]

First, you need to get the link to that Package you want to unpublish or the particular version of it, the link should be pointing to the .tgz file.

Example: https://artifacts-z.something.com/artifactory/npm-local/.npm/%40some-level/something/%40backbase/something-<VERSION>.tgz

and then get a user who has enough permission to do a deletion,

then you can just do a curl request to this endpoint like this:

curl -X DELETE -u <USER>:<PASSWORD> <LINK TO THE TGZ file>

I recommend trying this with, this will delete this particular version, just not npm, you can pretty much every package in JFrog using curl.

I do not claim that this might just work for you because the JFrog setup in the different organizations can be different and since in most places it's used in a similar way, it's worth trying this approach.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Saikat Chakrabortty