webtorrent/parse-torrent

'TypeError: Buffer.alloc is not a function' error on nodejs <5.10.0

yrjyrj123 opened this issue · 1 comments

I try to run this module, but see the error message like this:

/usr/local/lib/node_modules/parse-torrent/index.js:110
;(function () { Buffer.alloc(0) })()
                       ^

TypeError: Buffer.alloc is not a function
    at /usr/local/lib/node_modules/parse-torrent/index.js:110:24
    at Object.<anonymous> (/usr/local/lib/node_modules/parse-torrent/index.js:110:35)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/parse-torrent/bin/cmd.js:4:20)
    at Module._compile (module.js:409:26)

I have found reason, because of I am using nodejs<5.10.0 .

Maybe you can specify the version of node that your stuff works on in package.json to avoid this.

{ "engines" : { "node" : ">=5.10.0" } }

Thx.

Glad you got it figured out. The problem is that Buffer.alloc exists in 4.x too. I'd rather not add anything to package.json. Thanks.