File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,8 @@ function verifyNpmAuth(registry = NPM_DEFEAULT_REGISTRY) {
103
103
if ( whoami . status !== 0 ) {
104
104
const error = whoami . stderr . toString ( ) ;
105
105
const m = error . match ( npmErrorRegex ) ;
106
- switch ( m && m [ 1 ] ) {
106
+ const errorCode = m && m [ 1 ] ;
107
+ switch ( errorCode ) {
107
108
case "EINVALIDNPMTOKEN" :
108
109
throw new Error ( `Invalid auth token for npm registry: ${ registry } ` ) ;
109
110
case "ENEEDAUTH" :
@@ -118,7 +119,15 @@ function verifyNpmAuth(registry = NPM_DEFEAULT_REGISTRY) {
118
119
if ( token . status !== 0 ) {
119
120
const error = token . stderr . toString ( ) ;
120
121
const m = error . match ( npmErrorRegex ) ;
121
- throw new Error ( m ? `Auth token for '${ registry } ' returned error code ${ m [ 1 ] } ` : error ) ;
122
+ const errorCode = m && m [ 1 ] ;
123
+
124
+ // E403 means the token doesn't have permission to list tokens, but that's
125
+ // not required for publishing. Only fail for other error codes.
126
+ if ( errorCode === "E403" ) {
127
+ info ( `Token verification skipped: token doesn't have permission to list tokens (${ errorCode } )` ) ;
128
+ } else {
129
+ throw new Error ( m ? `Auth token for '${ registry } ' returned error code ${ errorCode } ` : error ) ;
130
+ }
122
131
}
123
132
}
124
133
You can’t perform that action at this time.
0 commit comments