node-java icon indicating copy to clipboard operation
node-java copied to clipboard

Install issues with Node v4.0.0

Open pintux opened this issue 11 years ago • 11 comments

Hi,

trying to: npm install --save java with Node v.4.0.0 It fails.

Below the npm errors:

[email protected] install /mypath/node_modules/java node-gyp rebuild

CXX(target) Release/obj.target/nodejavabridge_bindings/src/java.o In file included from ../src/java.cpp:1: In file included from ../src/java.h:9: In file included from ../node_modules/nan/nan.h:80: In file included from ../node_modules/nan/nan_new.h:190: ../node_modules/nan/nan_implementation_12_inl.h:181:66: error: too many arguments to function call, expected at most 2, have 4 return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv); ~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~ /Users/pintux/.node-gyp/4.0.0/include/node/v8.h:4675:3: note: 'New' declared here static Local New( ^ In file included from ../src/java.cpp:1: In file included from ../src/java.h:9: ../node_modules/nan/nan.h:171:25: error: redefinition of '_NanEnsureLocal' NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ ../node_modules/nan/nan.h:166:25: note: previous definition is here NAN_INLINE v8::Local _NanEnsureLocal(v8::Handle val) { ^ ../node_modules/nan/nan.h:317:12: error: no matching function for call to '_NanEnsureLocal' return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent()))); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:303:43: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                                      ^~~~~~~~~~~~~~~

../node_modules/nan/nan.h:171:25: note: candidate template ignored: substitution failure [with T = v8::Primitive] NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ ../node_modules/nan/nan.h:322:12: error: no matching function for call to '_NanEnsureLocal' return NanEscapeScope(NanNew(v8::Null(v8::Isolate::GetCurrent()))); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:303:43: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                                      ^~~~~~~~~~~~~~~

../node_modules/nan/nan.h:171:25: note: candidate template ignored: substitution failure [with T = v8::Primitive] NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ ../node_modules/nan/nan.h:327:12: error: no matching function for call to '_NanEnsureLocal' return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent()))); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:303:43: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                                      ^~~~~~~~~~~~~~~

../node_modules/nan/nan.h:171:25: note: candidate template ignored: substitution failure [with T = v8::Boolean] NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ ../node_modules/nan/nan.h:332:12: error: no matching function for call to '_NanEnsureLocal' return NanEscapeScope(NanNew(v8::False(v8::Isolate::GetCurrent()))); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:303:43: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                                      ^~~~~~~~~~~~~~~

../node_modules/nan/nan.h:171:25: note: candidate template ignored: substitution failure [with T = v8::Boolean] NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ ../node_modules/nan/nan.h:564:13: error: no member named 'smalloc' in namespace 'node' , node::smalloc::FreeCallback callback ~~~~~~^ ../node_modules/nan/nan.h:575:12: error: no matching function for call to 'New' return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); ^~~~~~~~~~~~~~~~~ /Users/pintux/.node-gyp/4.0.0/include/node/node_buffer.h:31:40: note: candidate function not viable: no known conversion from 'uint32_t' (aka 'unsigned int') to 'enum encoding' for 3rd argument NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate* isolate, ^ /Users/pintux/.node-gyp/4.0.0/include/node/node_buffer.h:43:40: note: candidate function not viable: 2nd argument ('const char ') would lose const qualifier NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate isolate, ^ /Users/pintux/.node-gyp/4.0.0/include/node/node_buffer.h:28:40: note: candidate function not viable: requires 2 arguments, but 3 were provided NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate* isolate, size_t length); ^ /Users/pintux/.node-gyp/4.0.0/include/node/node_buffer.h:36:40: note: candidate function not viable: requires 5 arguments, but 3 were provided NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate* isolate, ^ In file included from ../src/java.cpp:1: In file included from ../src/java.h:9: ../node_modules/nan/nan.h:579:12: error: no viable conversion from 'v8::MaybeLocalv8::Object' to 'v8::Localv8::Object' return node::Buffer::New(v8::Isolate::GetCurrent(), size); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/pintux/.node-gyp/4.0.0/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::MaybeLocalv8::Object' to 'const v8::Localv8::Object &' for 1st argument class Local { ^ /Users/pintux/.node-gyp/4.0.0/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::MaybeLocalv8::Object' to 'v8::Localv8::Object &&' for 1st argument class Local { ^ /Users/pintux/.node-gyp/4.0.0/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal' V8_INLINE Local(Local that) ^ /Users/pintux/.node-gyp/4.0.0/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S ' against 'v8::MaybeLocalv8::Object' V8_INLINE Local(S that) ^ In file included from ../src/java.cpp:1: In file included from ../src/java.h:9: ../node_modules/nan/nan.h:586:26: error: no member named 'Use' in namespace 'node::Buffer' return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); ~~~~~~~~~~~~~~^ ../node_modules/nan/nan.h:1403:12: error: no matching function for call to '_NanEnsureLocal' return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:303:43: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                                      ^~~~~~~~~~~~~~~

../node_modules/nan/nan.h:171:25: note: candidate template ignored: substitution failure [with T = v8::Function] NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ ../node_modules/nan/nan.h:1452:12: error: no matching function for call to '_NanEnsureLocal' return NanEscapeScope(node::MakeCallback( ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:303:43: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                                      ^~~~~~~~~~~~~~~

../node_modules/nan/nan.h:171:25: note: candidate template ignored: substitution failure [with T = v8::Value] NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ ../node_modules/nan/nan.h:1522:12: error: no matching function for call to '_NanEnsureLocal' return NanEscapeScope(handle->Get(NanNew(key)).Asv8::Object()); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../node_modules/nan/nan.h:303:43: note: expanded from macro 'NanEscapeScope'

define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))

                                      ^~~~~~~~~~~~~~~

../node_modules/nan/nan.h:171:25: note: candidate template ignored: substitution failure [with T = v8::Object] NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { ^ 13 errors generated. make: *** [Release/obj.target/nodejavabridge_bindings/src/java.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Darwin 14.5.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /mypath/node_modules/java gyp ERR! node -v v4.0.0 gyp ERR! node-gyp -v v3.0.1 gyp ERR! not ok npm ERR! Darwin 14.5.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "java" npm ERR! node v4.0.0 npm ERR! npm v2.14.2 npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. npm ERR! This is most likely a problem with the java package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get their info via: npm ERR! npm owner ls java npm ERR! There is likely additional logging output above.

pintux avatar Sep 09 '15 14:09 pintux

I'm also trying to install node-java and get a similar error with nodev4.0. This is on ubuntu 15

sudo npm install java -g

[email protected] install /usr/local/lib/node_modules/java node-gyp rebuild

make: Entering directory '/usr/local/lib/node_modules/java/build' CXX(target) Release/obj.target/nodejavabridge_bindings/src/java.o In file included from ../node_modules/nan/nan_new.h:190:0, from ../node_modules/nan/nan.h:80, from ../src/java.h:9, from ../src/java.cpp:1: ../node_modules/nan/nan_implementation_12_inl.h: In static member function ‘static NanIntern::FactoryBasev8::Signature::return_t NanIntern::Factoryv8::Signature::New(NanIntern::Factoryv8::Signature::FTH, int, NanIntern::Factoryv8::Signature::FTH_)’: ../node_modules/nan/nan_implementation_12_inl.h:181:76: error: no matching function for call to ‘v8::Signature::New(v8::Isolate_, NanIntern::Factoryv8::Signature::FTH&, int&, NanIntern::Factoryv8::Signature::FTH_&)’ return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv); ^ ../node_modules/nan/nan_implementation_12_inl.h:181:76: note: candidate is: In file included from ../src/java.h:5:0, from ../src/java.cpp:1: /home/john/.node-gyp/4.0.0/include/node/v8.h:4675:27: note: static v8::Localv8::Signature v8::Signature::New(v8::Isolate_, v8::Localv8::FunctionTemplate) static Local New( ...

jloveric avatar Sep 09 '15 18:09 jloveric

I believe it's the nan module issue, seems to have broken a lot of other modules https://github.com/nodejs/node/issues/2798

jloveric avatar Sep 11 '15 18:09 jloveric

this is definitely a defect with nan. Please file bugs there. We likely need to upgrade to the latest version once they have it available (it may be available now).

jsdevel avatar Sep 11 '15 19:09 jsdevel

Can you try building with this branch... https://github.com/joeferner/node-java/tree/upgrade-nan-to-2

joeferner avatar Sep 12 '15 18:09 joeferner

@joeferner I tried that branch and worked.

$ node -v
v4.0.0
$ git checkout upgrade-nan-to-2
Branch upgrade-nan-to-2 set up to track remote branch upgrade-nan-to-2 from origin by rebasing.
Switched to a new branch 'upgrade-nan-to-2'
$ npm install
|
> [email protected] install /Users/kimus/Develop/node-java
> node-gyp rebuild

  CXX(target) Release/obj.target/nodejavabridge_bindings/src/java.o
  CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaObject.o
  CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaScope.o
  CXX(target) Release/obj.target/nodejavabridge_bindings/src/methodCallBaton.o
  CXX(target) Release/obj.target/nodejavabridge_bindings/src/nodeJavaBridge.o
  CXX(target) Release/obj.target/nodejavabridge_bindings/src/utils.o
  SOLINK_MODULE(target) Release/nodejavabridge_bindings.node

> [email protected] postinstall /Users/kimus/Develop/node-java
> node postInstall.js

[email protected] node_modules/nan

kimus avatar Sep 12 '15 23:09 kimus

Thanks, it works for me as well.

John

jloveric avatar Sep 13 '15 01:09 jloveric

@joeferner great progress. I too have confirmed that npm install works with this branch, for both v0.12.7 and v4.0.0 on my Mac. Tests (npm test) also pass with v0.12.7 but numerous tests fail with v4.0.0 (as shown by Travis).

I diagnosed one class of failures. The function isWritable(prop) at line 187 in nodeJavaBridge.js is no longer working as designed. It was designed to deal with special cases for static fields and methods using special property names such as caller and arguments, but no longer does the right thing for those names. Apparently the behavior of Object.getOwnPropertyDescriptor() has changed.

A workaround is to check for those names explicitly by adding one line:

  if (prop === 'caller' || prop === 'arguments') return false;

jimlloyd avatar Sep 13 '15 01:09 jimlloyd

I finally got all the current CI tests to pass on all platforms with the new pull request. If no one has objections I'll merge with master, up the version to 0.6.0 and deploy to npm

joeferner avatar Sep 16 '15 19:09 joeferner

:+1:

jsdevel avatar Sep 16 '15 20:09 jsdevel

:+1:

jimlloyd avatar Sep 16 '15 20:09 jimlloyd

https://github.com/nodejs/node/issues/2798 is tracking npm modules with that don't work with node v4. I'm adding this comment just so there is a cross-reference that [email protected] is now compatible with node v4.

jimlloyd avatar Sep 18 '15 17:09 jimlloyd