question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Q] How to disable publish tarball file?

See original GitHub issue

I used npm@6 and lerna@^3.13.0 for publishing my package in customized npm registry. but it throw the error.

ZlibError: zlib: Cannot read property 'length' of null
    at Gzip.Zlib.(anonymous function) (/Users/yucong02/baidu/erp-fe/edam-vendor/node_modules/minizlib/index.js:126:21)
    at Gzip.write (/Users/yucong02/baidu/erp-fe/edam-vendor/node_modules/minizlib/index.js:247:21)
    at Object.source.on.chunk (/Users/yucong02/baidu/erp-fe/edam-vendor/node_modules/@lerna/pack-directory/node_modules/tar/lib/pack.js:340:18)
    at Object.emit (events.js:159:13)
    at Object.emit (/Users/yucong02/baidu/erp-fe/edam-vendor/node_modules/minipass/index.js:307:25)

However it’s successful with npm@<6.

Possible Solution

I guess the reason is that the customized registry does not support tarball file to publish. so How to disable publish tarball file?

lerna.json

{
    "packages": ["packages/*"],
    "version": "independent",
    "command": {
        "publish": {
            "skipGit": true,
            "registry": "http://registry.npm.baidu-int.com",
            "conventionalCommits": true,
            "changelogPreset": "befe",
            "message": "chore(release): publish %s"
        },
        "bootstrap": {
            "hoist": ["jest", "edam"],
            "npmClientArgs": []
        }
    },
    "ignoreChanges": ["**/__fixtures__/**", "**/__tests__/**"]
}

lerna-debug.log

0 silly argv { _: [ 'add' ],
0 silly argv   dev: true,
0 silly argv   D: true,
0 silly argv   scope: '**',
0 silly argv   globs: [],
0 silly argv   lernaVersion: '3.11.1',
0 silly argv   '$0': 'lerna',
0 silly argv   pkg: 'npm@5' }
1 notice cli v3.11.1
2 verbose rootPath /Users/yucong02/baidu/erp-fe/edam-vendor
3 info versioning independent
4 error ZlibError: zlib: Cannot read property 'length' of null
4 error     at Unzip.Zlib.(anonymous function) (/Users/yucong02/baidu/erp-fe/edam-vendor/node_modules/minizlib/index.js:126:21)
4 error     at Unzip.write (/Users/yucong02/baidu/erp-fe/edam-vendor/node_modules/minizlib/index.js:247:21)
4 error     at Unzip.flush (/Users/yucong02/baidu/erp-fe/edam-vendor/node_modules/minizlib/index.js:206:10)
4 error     at Unzip.end (/Users/yucong02/baidu/erp-fe/edam-vendor/node_modules/minizlib/index.js:213:10)
4 error     at Object.end (/Users/yucong02/baidu/erp-fe/edam-vendor/node_modules/pacote/node_modules/tar/lib/parse.js:416:21)
4 error     at PassThrough.onend (_stream_readable.js:598:10)
4 error     at Object.onceWrapper (events.js:254:19)
4 error     at PassThrough.emit (events.js:164:20)
4 error     at endReadableNT (_stream_readable.js:1054:12)
4 error     at _combinedTickCallback (internal/process/next_tick.js:138:11)

Context

Your Environment

Executable Version
lerna --version 3.13.0
npm --version 6.4.1
yarn --version 1.9.4
node --version 9.2.0
OS Version
macOS Sierra 10.12.3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
soederpopcommented, Mar 22, 2019

In my CI environment, I’m getting a lot of errors during the npm pack stage inside the lerna publish command. It happens randomly, and it happens in different packages each time, but the error comes from tar and the minizlib library.

In this same environment, single threading the npm publish commands for each package in lerna updated, using the actual npm publish command never runs into this issue.

the issue happens inside tar / minizlib, but it only started happening in recent versions of lerna.

i know this isn’t helpful but this has been a really hard thing for me to trace down.

00:03:43 lerna ERR!     at Unzip.Zlib.(anonymous function) (~/node_modules/minizlib/index.js:126:21)
00:03:43 lerna ERR!     at Unzip.emit (events.js:202:15)
00:03:43 lerna ERR!     at Zlib.zlibOnError [as onerror] (zlib.js:165:8)
00:03:43 lerna ERR!     at processChunkSync (zlib.js:405:12)
00:03:43 lerna ERR!     at Unzip.ZlibBase._processChunk (zlib.js:380:12)
00:03:43 lerna ERR!     at Unzip.write (~/node_modules/minizlib/index.js:245:30)
00:03:43 lerna ERR!     at Object.write (~/node_modules/tar/lib/parse.js:300:58)
00:03:43 lerna ERR!     at Yallist.pipes.forEach.p (~/node_modules/minipass/index.js:269:40)
00:03:43 lerna ERR!     at Yallist.forEach (~/node_modules/yallist/yallist.js:154:8)
00:03:43 lerna ERR!     at ReadStream.emit (~/minipass/index.js:269:20)
00:03:43 lerna ERR!     at ReadStream.emit ~/node_modules/fs-minipass/index.js:153:22)
00:03:43 lerna ERR!     at ReadStream.write (~node_modules/minipass/index.js:102:17)
00:03:43 lerna ERR!     at ReadStream.[_handleChunk] (~node_modules/fs-minipass/index.js:130:19)
00:03:43 lerna ERR!     at ReadStream.[_onread] (~/node_modules/fs-minipass/index.js:108:32)
00:03:43 lerna ERR!     at fs.read (~/node_modules/fs-minipass/index.js:100:22)
00:03:43 lerna ERR! lerna zlib: invalid block type
00:03:43 FATAL ERROR
00:03:43 `lerna publish patch --yes --no-push --loglevel debug --concurrency 1` failed with code 1
0reactions
JamesHenrycommented, Nov 29, 2022

Hi Folks, it looks like this one was resolved, so closing

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm-publish - npm Docs
npm-publish · a) a folder containing a program described by a package.json file; b) a gzipped tarball containing (a); c) a url that...
Read more >
npm publish cannot replace existing tarball - node.js
(note: inline links disabled because I'm new) > ubuntu@udoo:~/projects/node/node_modules/ab-file-manager$ npm publish > npm http PUT ...
Read more >
"unable to read .tar archive" error - Google Groups
First of all you can try skipping contents generation with -skip-contents flag to publish command. If you remove any file from aptly/pool directory,...
Read more >
Create a tar.gz file from a different directory, tar must keep files ...
To archive the contents of foo , change to foo and tar the current directory: -C /some/dir/foo . . To archive the foo...
Read more >
For the love of god, don't use .npmignore - Medium
npmignore to hide my test directory. What's worse is I probably have no idea this happened. npm publish doesn't show the files that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found