EvanOxfeld / node-unzip

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

Does not work with nodejs v10.0.0 #116

Closed Fatme closed 6 years ago

Fatme commented 6 years ago

It seems unzip does not work with version 10.0.0 of nodejs.

Steps to reproduce:

  1. Install node 10
  2. Add this to some file - for example test.js
    const unzip = require("unzip");
  3. Execute the file - node test.js

== An error is thrown ==

node[29597]: ../src/node_contextify.cc:631:static void node::contextify::ContextifyScript::New(const FunctionCallbackInfo &): Assertion `args[1]->IsString()' failed. 1: node::Abort() [/Users/havaluova/.nvm/versions/node/v10.0.0/bin/node] 2: node::InternalCallbackScope::~InternalCallbackScope() [/Users/havaluova/.nvm/versions/node/v10.0.0/bin/node] 3: node::contextify::ContextifyScript::New(v8::FunctionCallbackInfo const&) [/Users/havaluova/.nvm/versions/node/v10.0.0/bin/node] 4: v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/havaluova/.nvm/versions/node/v10.0.0/bin/node] 5: v8::internal::MaybeHandle v8::internal::(anonymous namespace)::HandleApiCallHelper(v8::internal::Isolate, v8::internal::Handle, v8::internal::Handle, v8::internal::Handle, v8::internal::Handle, v8::internal::BuiltinArguments) [/Users/havaluova/.nvm/versions/node/v10.0.0/bin/node] 6: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/havaluova/.nvm/versions/node/v10.0.0/bin/node] 7: 0x36e10e38427d Abort trap: 6

ZJONSSON commented 6 years ago

Are you sure this is not a problem with your test file? I ran the test suite of unzip on the node 10.0.0 docker image and all the tests passed? Can you share the test.js

image

Fatme commented 6 years ago

Hi @ZJONSSON

I've created a repro project https://github.com/Fatme/unzip-node10

Steps to reproduce:

  1. git clone git@github.com:Fatme/unzip-node10.git
  2. cd unzip-node10
  3. npm install
  4. node index.js

NOTE: I've tested it on Mac OS High Sierra

Fatme commented 6 years ago

I can confirm the issue is reproducible on windows too. I tested it on windows 10. Tested with this: https://nodejs.org/en/download/current/

GitHug commented 6 years ago

I can also confirm that this package does not seem to work on nodejs v10.0.0 and I get the same error as @Fatme. Another way to reproduce it is to open the Node repl and type require("unzip"). I use unzip version 0.1.11.

rosen-vladimirov commented 6 years ago

Hey all, Together with @Fatme we have investigated this case further and it turns out the problem is caused by our npm-shrinkwrap.json (same will happen in case you use package-lock.json). So, what is the problem - unzip package depends on fstream package. It has a dependency on graceful-fs version 3.0.11. As you can see here this version of graceful-fs depends on the natives package by using ^1.1.0. In our case, in npm-shrinkwrap.json we had the version of natives set to 1.1.2. However, there's a newer version of the natives package that addresses the issue with Node.js 10.x.x - 1.1.3: https://github.com/addaleax/natives/commits/v1.1.3

So the solution for us was to:

  1. Delete node_modules
  2. Delete npm-shrinkwrap.json (in your case it might be package-lock.json)
  3. Execute npm i
  4. Execute npm shrinkwrap