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

Fails to compile (on MacOS) with Node 10 #98

Closed
alextes opened this issue Sep 6, 2018 · 9 comments
Closed

Fails to compile (on MacOS) with Node 10 #98

alextes opened this issue Sep 6, 2018 · 9 comments

Comments

@alextes
Copy link

alextes commented Sep 6, 2018

node: v10.9.0
node-gyp: v3.7.0

Works fine with node 8 and 9.

Some of the people in #87 might actually be experiencing this issue instead.

❯ npm i -S node-zopfli

> node-zopfli@2.0.2 install /Users/alextes/code/zopfli/node_modules/node-zopfli                                                                    
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://node-zopfli.s3.amazonaws.com/Release/zopfli-v2.0.2-node-v64-darwin-x64.tar.gz                    
node-pre-gyp ERR! Pre-built binaries not found for node-zopfli@2.0.2 and node@10.9.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://node-zopfli.s3.amazonaws.com/Release/zopfli-v2.0.2-node-v64-darwin-x64.tar.gz              
node-pre-gyp ERR! Pre-built binaries not found for node-zopfli@2.0.2 and node@10.9.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
  CXX(target) Release/obj.target/zopfli/src/zopfli-binding.o
  CXX(target) Release/obj.target/zopfli/src/zopfli-binding.o
../src/zopfli-binding.cc../src/zopfli-binding.cc::137137::1515::  warningwarning: : 'Call' 'Call'is  isdeprecated  deprecated[-Wdeprecated-declarations] [-Wdeprecated-declarations]

    callback->Call(2, argv);
              ^
    callback->Call(2, argv);
              ^
../../nan/nan.h:1646:3: note../../nan/nan.h: :1646'Call': 3has:  been explicitlynote : marked deprecated'Call'  herehas                            
been explicitly marked deprecated here  NAN_DEPRECATED inline v8::Local<v8::Value>                                                                 

  ^
../../nan/nan.h:102:40:   NAN_DEPRECATED inline v8::Local<v8::Value>
note:   ^
expanded from macro 'NAN_DEPRECATED'
../../nan/nan.h:102:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
1 warning generated.
1 warning generated.
rm: ./Release/.deps/Release/obj.target/zopfli/src/zopfli-binding.o.d.raw: No such file or directory                                                
make: *** [Release/obj.target/zopfli/src/zopfli-binding.o] Error 1
gyp   CXX(target) Release/obj.target/zopfli/src/png/zopflipng.o
ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/alextes/.nvm/versions/node/v10.9.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:239:12)                                                       
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/Users/alextes/.nvm/versions/node/v10.9.0/bin/node" "/Users/alextes/.nvm/versions/node/v10.9.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/alextes/code/zopfli/node_modules/node-zopfli/lib/binding/node-v64-darwin-x64/zopfli.node" "--module_name=zopfli" "--module_path=/Users/alextes/code/zopfli/node_modules/node-zopfli/lib/binding/node-v64-darwin-x64"           
gyp ERR! cwd /Users/alextes/code/zopfli/node_modules/node-zopfli
gyp ERR! node -v v10.9.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/Users/alextes/.nvm/versions/node/v10.9.0/bin/node /Users/alextes/.nvm/versions/node/v10.9.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/alextes/code/zopfli/node_modules/node-zopfli/lib/binding/node-v64-darwin-x64/zopfli.node --module_name=zopfli --module_path=/Users/alextes/code/zopfli/node_modules/node-zopfli/lib/binding/node-v64-darwin-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/alextes/code/zopfli/node_modules/node-pre-gyp/lib/util/compile.js:83:29)           
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:961:16)                                                                       
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:250:5)                                               
node-pre-gyp ERR! System Darwin 17.7.0
node-pre-gyp ERR! command "/Users/alextes/.nvm/versions/node/v10.9.0/bin/node" "/Users/alextes/code/zopfli/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/alextes/code/zopfli/node_modules/node-zopfli
node-pre-gyp ERR! node -v v10.9.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
Failed to execute '/Users/alextes/.nvm/versions/node/v10.9.0/bin/node /Users/alextes/.nvm/versions/node/v10.9.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/alextes/code/zopfli/node_modules/node-zopfli/lib/binding/node-v64-darwin-x64/zopfli.node --module_name=zopfli --module_path=/Users/alextes/code/zopfli/node_modules/node-zopfli/lib/binding/node-v64-darwin-x64' (1)                  npm WARN zopfli@1.0.0 No description
npm WARN zopfli@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-zopfli@2.0.2 install: `node-pre-gyp install --fallback-to-build`                                                                     
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-zopfli@2.0.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.                                                 

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/alextes/.npm/_logs/2018-09-06T06_51_53_364Z-debug.log

../src/png/zopflipng.cc:3:10: fatal error: 'nan.h' file not found
#include "nan.h"
         ^~~~~~~
1 error generated.
make: *** [Release/obj.target/zopfli/src/png/zopflipng.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/alextes/.nvm/versions/node/v10.9.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:239:12)                                                       
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/Users/alextes/.nvm/versions/node/v10.9.0/bin/node" "/Users/alextes/.nvm/versions/node/v10.9.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/alextes/code/zopfli/node_modules/node-zopfli/lib/binding/node-v64-darwin-x64/zopfli.node" "--module_name=zopfli" "--module_path=/Users/alextes/code/zopfli/node_modules/node-zopfli/lib/binding/node-v64-darwin-x64"           
gyp ERR! cwd /Users/alextes/code/zopfli/node_modules/node-zopfli
gyp ERR! node -v v10.9.0
gyp ERR! node-gyp -v v3.7.0
@chinhnguyen
Copy link

Hi, this is a problem with nan not updated to latest which is required to be compiled with Node10.
After force installing latest nan, you will face the problem of some header file not found, this is because the new npm won't do submodule update anymore.

I've tried a dirty hack by copying the whole zopfli code to the repo and it can be installed normally.

I will create PR for this fix and hope the owner will have sometime to merge it.

@chinhnguyen
Copy link

take back the submodule thing, in fact we just need to force it to build again then it should work:

in package.json's scripts, change:

"install": "node-pre-gyp install --fallback-to-build",

to

"install": "node-pre-gyp install --build-from-source",

and it should work

@chinhnguyen
Copy link

you can try it out here

@edahlseng
Copy link

@chinhnguyen do you have your updated package published anywhere?

@chinhnguyen
Copy link

I'm afraid not, currently I'm pointing directly to my own fork.

@geonanorch
Copy link

Just hit that issue as well under Windows 8.1 + MSYS2.

It is apparently caused by a behavior change in node 10 (issue #21063), which was addressed recently in node-pre-gyp (issue #391), which is used to build node-zopfli.

To fix this issue one can alter node-zopfli's package.json to upgrade node-pre-gyp to v0.12:

 . . . . . . . . .
  "dependencies": {
 . . . . . . . . .
    "node-pre-gyp": "^0.12.0"
  },
 . . . . . . . . .

After that change running npm install should succeed (did for me).

@chinhnguyen
Copy link

chinhnguyen commented Jan 25, 2019 via email

@mikemaccana
Copy link

Woo thanks @geonanorch you helpful Windows 8 user 😂

@pierreinglebert
Copy link
Owner

fixed in the new published v2.0.3

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

6 participants