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) {
103103 if ( whoami . status !== 0 ) {
104104 const error = whoami . stderr . toString ( ) ;
105105 const m = error . match ( npmErrorRegex ) ;
106- switch ( m && m [ 1 ] ) {
106+ const errorCode = m && m [ 1 ] ;
107+ switch ( errorCode ) {
107108 case "EINVALIDNPMTOKEN" :
108109 throw new Error ( `Invalid auth token for npm registry: ${ registry } ` ) ;
109110 case "ENEEDAUTH" :
@@ -118,7 +119,15 @@ function verifyNpmAuth(registry = NPM_DEFEAULT_REGISTRY) {
118119 if ( token . status !== 0 ) {
119120 const error = token . stderr . toString ( ) ;
120121 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+ }
122131 }
123132}
124133
You can’t perform that action at this time.
0 commit comments