File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,18 @@ exports.prereleaseTags = async packageName => {
9595 tags = Object . keys ( JSON . parse ( stdout ) )
9696 . filter ( tag => tag !== 'latest' ) ;
9797 } catch ( error ) {
98- if ( ( ( JSON . parse ( error . stdout ) || { } ) . error || { } ) . code !== 'E404' ) {
98+ // HACK: NPM is mixing JSON with plain text errors. Luckily, the error
99+ // always starts with 'npm ERR!' (unless you have a debugger attached)
100+ // so as a solution, until npm/cli#2740 is fixed, we can remove anything
101+ // starting with 'npm ERR!'
102+ /** @type {string } */
103+ const errorMessage = error . stderr ;
104+ const errorJSON = errorMessage
105+ . split ( '\n' )
106+ . filter ( error => ! error . startsWith ( 'npm ERR!' ) )
107+ . join ( '\n' ) ;
108+
109+ if ( ( ( JSON . parse ( errorJSON ) || { } ) . error || { } ) . code !== 'E404' ) {
99110 throw error ;
100111 }
101112 }
You can’t perform that action at this time.
0 commit comments