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

Can't build for electron #81

Closed
jimmybaker opened this issue Sep 10, 2015 · 7 comments
Closed

Can't build for electron #81

jimmybaker opened this issue Sep 10, 2015 · 7 comments

Comments

@jimmybaker
Copy link

I'm trying to use this module in an electron project http://electron.atom.io/

Electron provides a few methods for rebuilding native modules which are listed here: http://electron.atom.io/docs/v0.32.0/tutorial/using-native-node-modules/

I get the same result no matter how I try to rebuild it.

➜  cohub-pob git:(master) ✗ ./node_modules/.bin/electron-rebuild

> [email protected] install /projects/cohub-pob/node_modules/printer
> node-gyp rebuild

  CXX(target) Release/obj.target/node_printer/src/node_printer.o
  CXX(target) Release/obj.target/node_printer/src/node_printer_posix.o

../src/node_printer_posix.cc:327:56: error: no member named 'HasIndexedPropertiesInExternalArrayData' in 'v8::Object'
    else if(arg0->IsObject() && arg0.As<v8::Object>()->HasIndexedPropertiesInExternalArrayData())
                                ~~~~~~~~~~~~~~~~~~~~~  ^
../src/node_printer_posix.cc:329:63: error: no member named 'GetIndexedPropertiesExternalArrayData' in 'v8::Object'
        data.assign(static_cast<char*>(arg0.As<v8::Object>()->GetIndexedPropertiesExternalArrayData()),
                                       ~~~~~~~~~~~~~~~~~~~~~  ^
../src/node_printer_posix.cc:330:44: error: no member named 'GetIndexedPropertiesExternalArrayDataLength' in 'v8::Object'
                    arg0.As<v8::Object>()->GetIndexedPropertiesExternalArrayDataLength());
                    ~~~~~~~~~~~~~~~~~~~~~  ^
3 errors generated.
make: *** [Release/obj.target/node_printer/src/node_printer_posix.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/projects/cohub-pob/node_modules/electron-rebuild/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Darwin 14.4.0
gyp ERR! command "node" "/projects/cohub-pob/node_modules/electron-rebuild/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /projects/cohub-pob/node_modules/printer
gyp ERR! node -v v0.12.3
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok

npm ERR! Darwin 14.4.0
npm ERR! argv "node" "/projects/cohub-pob/node_modules/electron-rebuild/node_modules/npm/bin/npm-cli.js" "rebuild" "--target=0.32.1" "--arch=x64"
npm ERR! node v0.12.3
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 printer 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 printer
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /projects/cohub-pob/node_modules/npm-debug.log

Process exited with code: 1
Error: Process exited with code: 1
    at ChildProcess.<anonymous> (/projects/cohub-pob/node_modules/electron-rebuild/lib/spawn.js:55:26)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Socket.<anonymous> (child_process.js:1183:11)
    at Socket.emit (events.js:107:17)
    at Pipe.close (net.js:485:12)
@vikrantpogula
Copy link

@jimmybaker this is a issue with building native modules using node-pre-gyp, which node-printer uses.
The actual issue is tracked here mapbox/node-pre-gyp#112

EDIT: Mistaken here

@vikrantpogula
Copy link

@jimmybaker im sorry i seem to have been mistaken here.. these errors are because of the new V8 updates that causes this to fail to build.

ignore my previous comment

@jasonfutch
Copy link

What is the fix?

@jimmybaker
Copy link
Author

Still don't know. Haven't made any progress with it. If anyone has a solution, would love to see it here.

@jimmybaker
Copy link
Author

It seems these methods are no longer available in the version of v8 that electron uses now. Here's an issue in node regarding the removed methods: nodejs/node#2977

@jimmybaker
Copy link
Author

So I've got a temporary work around for this. The code that's causing this all to fail is not essential if you're using node version 4 or greater. So I've forked the repo and made a branch that simply removes the offending code. Since the code doesn't provide any features for node 4 users then it can be safely removed.

To get this library working with electron or nw projects running on node version 4, install it with:

> npm install git://github.com/BitPerformanceLabs/node-printer.git#node4

Once this is installed you can run electron-rebuild or the node-gyp rebuild for nw projects.

@tojocky
Copy link
Owner

tojocky commented Sep 29, 2015

also added in https://www.npmjs.com/package/printer . now you can install directly.
Closing this issue.

@tojocky tojocky closed this as completed Sep 29, 2015
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

4 participants