EvanOxfeld / node-unzip

node.js cross-platform unzip using streams
MIT License
613 stars 343 forks source link

Not working with Node 12, primordials is not defined #122

Open martinlevesque opened 5 years ago

martinlevesque commented 5 years ago

With Node 12, simply doing a require("unzip") will crash your application with the following error:

const { Math, Object, Reflect } = primordials;
                                  ^

ReferenceError: primordials is not defined
    at fs.js:27:35
    at req_ (/home/martin/works/XXX/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/home/martin/works/XXX/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/home/martin/works/XXX/node_modules/fstream/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
ZeldaZach commented 5 years ago

Had the same issue on my project. Moved to unzipper fork instead, since this project seems abandoned unfortunately

dshook commented 5 years ago

The error I was getting when requiring this after the upgrade to node 12 is this:

/usr/local/bin/node[190]: ../src/node_contextify.cc:651:static void node::contextify::ContextifyScript::New(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `args[1]->IsString()' failed.

Hopefully will save someone else some time since search was coming up pretty empty on that one

jacobq commented 4 years ago

Same root cause as https://github.com/EvanOxfeld/node-unzip/issues/115

BoWang816 commented 4 years ago

I changed my node version to 10.16.0, and it works