npm / npm/cli

[BUG] Npm pack (via publish via lerna version) returns `Bash exited with code '1'`

Open
#4,157 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage Release 8.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
This issue exists in the latest npm version
  • I am using the latest npm
Current Behavior

After upgrading to node@16.13.1 and npm@8.2.0 I keep getting errors when publishing packages:

(npm pack is called initially from lerna)

lerna success published 73 packages
lerna ERR! ZlibError: zlib: invalid block type
lerna ERR!     at Unzip.write (/home/alexander/Workspace/if/ids-core/node_modules/minizlib/index.js:154:22)
lerna ERR!     at Object.write (/home/alexander/Workspace/if/ids-core/node_modules/tar/lib/parse.js:354:57)
lerna ERR!     at Yallist.<anonymous> (/home/alexander/Workspace/if/ids-core/node_modules/minipass/index.js:384:18)
lerna ERR!     at Yallist.forEach (/home/alexander/Workspace/if/ids-core/node_modules/minipass/node_modules/yallist/yallist.js:156:8)
lerna ERR!     at ReadStream.emit (/home/alexander/Workspace/if/ids-core/node_modules/minipass/index.js:383:20)
lerna ERR!     at ReadStream.emit (/home/alexander/Workspace/if/ids-core/node_modules/fs-minipass/index.js:175:22)
lerna ERR!     at ReadStream.write (/home/alexander/Workspace/if/ids-core/node_modules/minipass/index.js:168:12)
lerna ERR!     at ReadStream.[_handleChunk] (/home/alexander/Workspace/if/ids-core/node_modules/fs-minipass/index.js:146:19)
lerna ERR!     at ReadStream.[_onread] (/home/alexander/Workspace/if/ids-core/node_modules/fs-minipass/index.js:123:32)
lerna ERR! lerna zlib: invalid block type
##[error]Bash exited with code '1'.
Finishing: Publish packages to Azure Artifacts

All of the packages are published, but this error stops the build pipeline.

It's tracked down to zlib which is used by npm pack: https://github.com/isaacs/minizlib/issues/8#issuecomment-990112556

I also experienced a different ZlibError before: https://github.com/lerna/lerna/issues/2278, and that solved it by upgrading to node@14.

This issue was introduced when Azure upgraded the Ubuntu 20.04 image to use node@16: https://github.com/actions/virtual-environments/issues/4446

We cannot downgrade the image our selves, or use the suggested yarn solution mentioned here: https://github.com/lerna/lerna/issues/2278#issuecomment-979006153

Expected Behavior

With this setup, no errors are returned

Steps To Reproduce

Only reproducable with lerna publish, could it be because the publish package process (pack and publish) is too fast, or not enough time between tasks?

Environment
  • npm: 8.2.0
  • Node: 16.13.1
  • OS: Ubuntu 18.04 and Ubuntu 20.04
  • platform: Lenovo Thinkpad P1 and Azure Devops Ubuntu 20.04 image
  • Lerna 4.0.0
  • npm config:
; "user" config from /home/alexander/.npmrc

; @guybrush:registry = "https://waypoint.myget.org/F/relax/auth/(protected)/npm/" ; overridden by project
; @ids-core:registry = "https://pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/" ; overridden by project
; @ids-js:registry = "https://pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/" ; overridden by project
; @ids-react:registry = "https://pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/" ; overridden by project
; @ids-wc:registry = "https://pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/" ; overridden by project
; @if-design-components-react:registry = "https://pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/" ; overridden by project
; @if-design-system:registry = "https://pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/" ; overridden by project
@relax:registry = "https://waypoint.myget.org/F/relax/auth/(protected)/npm/" 
//pkgs.dev.azure.com/if-it/_packaging/common-external-packages/npm/:_password = (protected) 
//pkgs.dev.azure.com/if-it/_packaging/common-external-packages/npm/:email = (protected) 
//pkgs.dev.azure.com/if-it/_packaging/common-external-packages/npm/:username = "if-it" 
//pkgs.dev.azure.com/if-it/_packaging/common-external-packages/npm/registry/:_password = (protected) 
//pkgs.dev.azure.com/if-it/_packaging/common-external-packages/npm/registry/:username = "if-it" 
//pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/:_password = (protected) 
//pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/:email = (protected) 
//pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/:username = "if-it" 
//pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/:_password = (protected) 
//pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/:email = (protected) 
//pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/:username = "if-it" 
//registry.npmjs.org/:_authToken = (protected) 
email = (protected) 

; "project" config from /home/alexander/Workspace/if/ids-core/.npmrc

@guybrush:registry = "https://waypoint.myget.org/F/relax/auth/(protected)/npm/" 
@ids-core:registry = "https://pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/" 
@ids-js:registry = "https://pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/" 
@ids-react:registry = "https://pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/" 
@ids-wc:registry = "https://pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/" 
@if-design-components-react:registry = "https://pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/" 
@if-design-system:registry = "https://pkgs.dev.azure.com/if-it/40e35854-e791-490e-bec8-da33c65c3187/_packaging/if-design-system/npm/registry/" 
always-auth = true 
registry = "https://pkgs.dev.azure.com/if-it/_packaging/common-external-packages/npm/registry/" 

; node bin location = /home/alexander/.nvm/versions/node/v16.13.1/bin/node
; cwd = /home/alexander/Workspace/if/ids-core
; HOME = /home/alexander
; Run `npm config ls -l` to show all defaults.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure through lerna publish and npm pack with Node 16.13.1, npm 8.2.0, and the Ubuntu 20.04 environment described. Read the linked minizlib issue alongside the npm pack path and compare behavior across the reported Node versions. Done means publishing completes without the zlib error or leaves a clearly diagnosed compatibility failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, javascript, node.js
Domain
cli, devops, release
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.