TooTallNate / NodObjC

The Node.js ⇆ Objective-C bridge

Home Page:http://tootallnate.github.io/NodObjC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[npm install nodobjc] failing due to ffi and node 4.x incompatibility

luan007 opened this issue · comments

Hi,

It seems the ffi and ref that is refered from npm install nodobjc is causing build failure with node version 4.2.1 (and other 4.x). Cloning the proj and doing npm install works perfectly fine though ..

log of npm install nodobjc

npm install nodobjc
|
> ref@1.0.2 install /private/tmp/node_modules/nodobjc/node_modules/ref
> node-gyp rebuild

  CXX(target) Release/obj.target/binding/src/binding.o
In file included from ../src/binding.cc:8:
../node_modules/nan/nan.h:261:25: error: redefinition of '_NanEnsureLocal'
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) {
                        ^
../node_modules/nan/nan.h:256:25: note: previous definition is here
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) {

... etc

doing npm install from repo clone shows higher ref version

cat package.json  | grep version
  "version": "1.1.3",

Updating npm record would fix perhaps?

Thanks

+1 I am having same issue.

One workaround for now is:

npm i -g git://github.com/kjunichi/NodObjC#v4.x

I'm seeing the same thing with Node.js v4.2.3, the master version of this repo has no issues with npm install as @luan007 mentioned.

@TooTallNate is there anything holding back a new release to npm?

nodobjc v2.1.0 has been published. Please let me know if there are any issues.

@TooTallNate thanks for publishing a new release!

It's working well with Node.js v4.2.3 in node-core-bluetooth.

I am still having this issue. I'm using node v4.2.2

Steps to Reproduce

  1. npm i nodobjc
  2. var $ = require('nodobjc');

This is exactly what the documentation says to do. @TooTallNate is there a resolution to this? Should I install the forked version in @AddictArts comment above? I can't imagine anything else I'm doing wrong as the two above steps are all I've done so far and the Electron app I'm making works perfectly without the require('nodobjc') line.

screen shot 2016-01-08 at 7 58 47 am

@atdrago It looks like you're using it for Electron. Which version are you running? I think you need 0.36.*

@kahluagenie I've tried it with both 0.36.2 and 0.35.5 and I'm getting the same error.

@atdrago Weird. I had the same error before, but it's working fine for me now after updating to the latest nodobjc release. I did have to make sure that the --version flag passed into electron-packager is 0.36 on top of updating to the latest "packager" and "prebuilt" libs.

@atdrago You most likely just need to re-compile NodObjC for the version of node.js that electron uses. Make sure you're following the directions for using native Node.js addons in Electron.

@TooTallNate That was it! Thank you!