Skip to content

Commit

Permalink
fix(publish): catch publish conflict 403 error from npm (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed Jun 28, 2023
1 parent 0b823d5 commit 738c028
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/publish/src/publish-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,10 @@ export class PublishCommand extends Command<PublishCommandOption> {
return pkg;
})
.catch((err) => {
if (err.code === 'EPUBLISHCONFLICT') {
if (
err.code === 'EPUBLISHCONFLICT' ||
(err.code === 'E403' && err.body?.error?.includes('You cannot publish over the previously published versions'))
) {
tracker.warn('publish', `Package is already published: ${pkg.name}@${pkg.version}`);
tracker.completeWork(1);

Expand Down

0 comments on commit 738c028

Please sign in to comment.