Open AllanOricil opened 1 month ago
I can't understand how a simple feature like this keeps breaking. I updated npm to the 10.8.2 and tried to unpublish the whole package and just a version
and again it did not work...
@AllanOricil I tested and it's working as expected. I believe could you please check the syntax npm unpublish @namespace/package-name@x.x.x
not include v
in the version specification so e.g. npm unpublish @namespace/package-name@1.2.3
~/workarea/rep/testpkg $ npm view @myscope/testpkg versions
[ '1.2.0', '1.3.0' ]
~/workarea/rep/testpkg $ npm unpublish @myscope/testpkg@1.2.0
- @myscope/testpkg@1.2.0
~/workarea/rep/testpkg $ npm view @myscope/testpkg versions
1.3.0
~/workarea/rep/testpkg $ npm unpublish @myscope/testpkg -f
npm warn using --force Recommended protections disabled.
- @milansmeva/testpkg
~/workarea/rep/testpkg $ npm view @myscope/testpkg versions
npm error code E404
npm error 404 Unpublished on 2024-08-02T21:21:51.311Z
npm error 404
npm error 404 '@myscope/testpkg' is not in this registry.
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.
npm error A complete log of this run can be found in: /Users/milaninfy/.npm/_logs/2024-08-02T21_22_07_744Z-debug-0.log
@milaninfy it is clearly not working as expected. If the version is wrong, or doesn't exist, it should tell "HEY IT IS WRONG!" and exit with 1 instead of 0.
Behaviour is by design here, It exits correctly with code 0 if the version doesn't exist then it's effectively gone, however a logging would be useful here if the version doesn't exit.
@milaninfy so NPM by design displays 200, OK and exit 0 when UMPUBLISH fails? weird.
How can a User know umpublish failed? even with --verbose, there is no way he can know it didn't work unless he/she opens NPM UI
How can a CI job know umpublish failed, and then display failure? can you give an example showing how to handle this type of error using major CI environments, like Github Actions? I have a Github Actions Workflow with an input for the package version. User can provide anything in that input. If User provides a version that doesn't exist, my CI Workflow will finish with Success. Does it make sense for you or @shadowspawn?
This is clearly a new known error type "UNKNOWN VERSION" which has to be treated as: 400, NOT OK, 1
Hi @AllanOricil
I gave a thumbs-up to the comment which diagnosed the error in the command you were running. I had read your description (thanks for the clear description) but hadn't spotted the extra v
. I wasn't offering an opinion on whether the behaviour was ideal.
I appreciate the lack of clues provided by the unpublish caused you some confusion and cost you some time.
Perhaps you could change the title of this issue to more accurately describe what turned out to be the problem.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
I just published v0.2.1 and I can't unpublish it. (less than 72h)
npm unpublish @namespace/package-name@vx.x.x -f
does not throw exception, but does not work. I unpublished my package and it still present in npm. Because of that, I can't publish that version againno error message, and this unpublish command doesn't work, even after
npm login
Expected Behavior
at least an exception should appear if I can't unpublish a package
Steps To Reproduce
npm unpublish @namespace/package-name@vx.x.x -f
Environment
//journeylab-tech-845044614340.d.codeartifact.us-east-2.amazonaws.com/npm/flowfuse/:_authToken = (protected) //journeylab-tech-845044614340.d.codeartifact.us-east-2.amazonaws.com/npm/node-ready/:_authToken = (protected) //registry.npmjs.org/:_authToken = (protected) registry = "https://registry.npmjs.org"
; "project" config from /Users/ec2-user/node-ready-ascend-data-storage/.npmrc
@node-ready:registry = "https://registry.npmjs.org/"
; node bin location = /Users/ec2-user/.nvm/versions/node/v18.19.1/bin/node ; node version = v18.19.1 ; npm local prefix = /Users/ec2-user/node-ready-ascend-data-storage ; npm version = 10.2.4 ; cwd = /Users/ec2-user/node-ready-ascend-data-storage ; HOME = /Users/ec2-user ; Run
npm config ls -l
to show all defaults.