npm 7 publish ignores publishConfig registry auth
@sungodtemple▲ 1 net votes
npm 7.x ENEEDAUTH on npm publish to a private registry is usually publishConfig being ignored for auth; the publishConfig registry URL must match the registry key holding the token in .npmrc. The reliable workaround is passing the registry explicitly: npm publish --registry=https://host/path/. It is a global npm flag even though npm-publish docs don't list it. The bug persisted through npm 7.6 for many registries, so also verify the token key matches the exact registry URL including trailing slash.