[BUG] regression, npm publish folder
has a new and completely incompatible behaviour where folder
is interpreted as a package name and is then fetched from the registry
#4126
Labels
Bug
thing that needs fixing
Discuss
will be discussed at the next internal call
Priority 0
will get attention right away
Release 8.x
work is associated with a specific npm 8 release
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
npm publish folder
syntax has stopped working almost completely if thefolder
is not prefixed with a./
and is not an absolute path. Not only has it stopped working, it is doing utter nonsense, and is producing really weird output as outlined in the repro section below. So much so it no longer appears to be doing anything recognisable as publishing a package at all.This is a rather critical piece of functionality that is going to break a bunch of scripts all over the internet. I personally found this bug when an unchanged Github Actions workflow stopped publishing canary builds of my package.
The syntax I have used there is
npm publish dist --access public --tag canary
. The package has been built correctly into a directory nameddist
, and it has apackage.json
with a name (that is notdist
but@citeproc-rs/wasm
). For the past year, this script successfully published dozens of versions of the package, but today it does not. It now fails with an ETARGET message, saying that the package/versiondist@canary
could not be found. This is completely unexpected, not only because it worked before, but because there is no documented syntax ofnpm publish
where any command line argument accepts a package name. That has always been implied from thepackage.json
!The Steps to Reproduce below has a guided tour of the insanity that is going on with
npm publish
.Expected Behavior
npm publish folder
should publish a folder!!! Even if that were not literally the documented syntax of the command, you would expect it to fail with a mysterious error message like ETARGET or a 404. There is no such documented syntaxnpm publish packagename
! Why would it try looking it up on the registry!!!Steps To Reproduce
mkdir folder
"name": "asdfasdfasdf-nonexistent-package"
npm publish [<tarball>|<folder>]
, no mention offolder
being a package namenpm publish folder --dry-run
with npm 8.2.0Watch, in horror, as NPM appears to download the tarball for package
folder@0.0.4
, list out its contents, and print the summary of the tarball. There is zero relation between doing this andnpm publish
. I am absolutely speechless.It goes on. The behaviour is different if the name of the directory is not an existing package in the registry.
mv folder asdfasdfasdf-nonexistent-package
npm publish asdfasdfasdf-nonexistent-package --dry-run
Receive:
There's a THIRD variation. This is when the name of the folder is an existing package on the registry, but you're using the
--tag
flag, and the package of that name (again, COMPLETELY irrelevant, NPM should not be looking it up at all) does not have that tag. It is relevant to post here because you get more completely different output.folder
npm publish folder --dry-run --tag canary
There is a workaround: use the syntax
npm publish ./folder
. Then it knows the folder is a folder.Environment
The text was updated successfully, but these errors were encountered: