Node: TypeError: Cannot read property 'length' of null

Created on 21 Nov 2017  路  3Comments  路  Source: nodejs/node

https://github.com/nodejs/node/blob/2ba93f6ed7c96684ed7aeaa32db59ae8e5885f03/lib/zlib.js#L493

const zlib = require('zlib');

const arr= new Int8Array([0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
console.log(zlib.gunzipSync(arr))
zlib.js:488
  return (buffers.length === 1 ? buffers[0] : Buffer.concat(buffers, nread));
                  ^

TypeError: Cannot read property 'length' of null
    at processChunkSync (zlib.js:488:19)
    at zlibBufferSync (zlib.js:119:12)
    at Object.gunzipSync (zlib.js:646:14)
    at Object.<anonymous> (D:\tests\2017\11\test-zlib.js:7:18)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Function.Module.runMain (module.js:682:10)
  • Version: v9.0.0
  • Platform: Windows 8.1 64-bit

It works fine on 6, 7 and 8 node versions.

duplicate zlib

Most helpful comment

I鈥檓 closing this as a duplicate of https://github.com/nodejs/node/issues/17041, it鈥檚 going to be fixed with the next 9.x release.

Thanks for the report, though!

All 3 comments

I鈥檓 closing this as a duplicate of https://github.com/nodejs/node/issues/17041, it鈥檚 going to be fixed with the next 9.x release.

Thanks for the report, though!

Updating to latest version of node solves the issue for me. Cheers

Im having this kind of erron when using this code sudo npm install

any one can share solution?

node version 10.16.0
npm version 6.9.0

thanks in advance

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielstaleiny picture danielstaleiny  路  3Comments

Brekmister picture Brekmister  路  3Comments

seishun picture seishun  路  3Comments

willnwhite picture willnwhite  路  3Comments

cong88 picture cong88  路  3Comments