Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not work with Node.js v9.0.0 #169

Closed
ndaidong opened this issue Nov 1, 2017 · 6 comments
Closed

Do not work with Node.js v9.0.0 #169

ndaidong opened this issue Nov 1, 2017 · 6 comments

Comments

@ndaidong
Copy link

ndaidong commented Nov 1, 2017

Hello,

I got the following error after upgrading Node.js to v9.0.0:

/var/www/projects/news-loader/node_modules/natural/lib/natural/classifiers/classifier.js:32
    if (e.code !== 'MODULE_NOT_FOUND') throw e;
                                       ^

Error: The module '/var/www/projects/news-loader/node_modules/webworker-threads/build/Release/WebWorkerThreads.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 59. Please try re-compiling or re-installing

The issue happened within natural's classifier module, where I founded:

try {
    var Threads = require('webworker-threads');
} catch (e) {
    // Since webworker-threads are optional, only thow if the module is found
    if (e.code !== 'MODULE_NOT_FOUND') throw e;
}

It looks like the module webworker-threads could not be imported here because it was built with C++ and an older Node.js version as the log written. How I can fix this?

Thank you.

@fivdi
Copy link

fivdi commented Nov 1, 2017

It looks like the module webworker-threads could not be imported here because it was built with C++ and an older Node.js version as the log written. How I can fix this?

It looks like webworker-threads was installed with Node 8.x but at runtime Node 9 is used. Try reinstalling webworker-threads with Node 9 to see if it works.

@ndaidong
Copy link
Author

ndaidong commented Nov 1, 2017

@fivdi : I've tried. After I removed node_modules and installed again, it throws an error and aborts the process.

ndaidong@bella-mint /var/www/projects/news-loader $ npm i webworker-threads
npm WARN npm npm does not support Node.js v9.0.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
/usr/local/bin/node[26267]: ../src/node_zlib.cc:430:static void node::{anonymous}::ZCtx::Init(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `args.Length() == 7 && "init(windowBits, level, memLevel, strategy, writeResult, writeCallback," " dictionary)"' failed.
 1: node::Abort() [npm]
 2: node::Assert(char const* const (*) [4]) [npm]
 3: 0x12beb2a [npm]
 4: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [npm]
 5: 0xb09a37 [npm]
 6: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [npm]
 7: 0xc024b5842fd
Aborted

@fivdi
Copy link

fivdi commented Nov 1, 2017

Did you read everything at nodejs/node#16649?
In particular this comment nodejs/node#16649 (comment) and this comment nodejs/node#16649 (comment)?
Have you tried with the version of npm bundled with Node 9?

@ndaidong
Copy link
Author

ndaidong commented Nov 1, 2017

@fivdi yes, I've tried with npm bundled with Node 9. I also tried to remove it and reinstall it again with npm u -g npm and got the same result.

@fivdi
Copy link

fivdi commented Nov 1, 2017

If the bundled version of npm is used it should work. Here's what I see:

$ node -v
v9.0.0
$ npm -v
5.5.1
$ npm install webworker-threads

> [email protected] install /home/brian/wwt/node_modules/webworker-threads
> node-gyp rebuild

make: Entering directory `/home/brian/wwt/node_modules/webworker-threads/build'
  CXX(target) Release/obj.target/WebWorkerThreads/src/WebWorkerThreads.o
In file included from ../../nan/nan.h:192:0,
                 from ../src/WebWorkerThreads.cc:12:
../../nan/nan_maybe_43_inl.h: In function ‘Nan::Maybe<bool> Nan::ForceSet(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’:
../../nan/nan_maybe_43_inl.h:112:73: warning: ‘v8::Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’ is deprecated (declared at /home/brian/.node-gyp/9.0.0/include/node/v8.h:3114): Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
   return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
                                                                         ^
  SOLINK_MODULE(target) Release/obj.target/WebWorkerThreads.node
  COPY Release/WebWorkerThreads.node
make: Leaving directory `/home/brian/wwt/node_modules/webworker-threads/build'
npm WARN saveError ENOENT: no such file or directory, open '/home/brian/wwt/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/brian/wwt/package.json'
npm WARN wwt No description
npm WARN wwt No repository field.
npm WARN wwt No README data
npm WARN wwt No license field.

+ [email protected]
added 3 packages in 9.244s
$ 

Note that the compile warning can be ignored (see nodejs/nan#707 for further details.)

You'll need to figure out why the bundled version of npm is not being used. Note that it's not possible to reinstall the bundled version of npm. So don't do npm u -g npm as this will install the version of [email protected] that will not work. The bundled version of [email protected] was patched in order to function correctly.

@ndaidong
Copy link
Author

ndaidong commented Nov 1, 2017

@fivdi I tried to run your commands within a docker container, the error was still occurred:

screenshot_2017-11-01_19-20-36

It looks like the problem does not relate to node-webworker-threads but npm or gcc or something else. I've downgraded Node.js on my computer to v8.9.0 to get things work as before while waiting for the clearer news.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants