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

Error installing x509: error [email protected] install: node-gyp rebuild on macOS #86

Open
DigitalLeaves opened this issue Dec 16, 2019 · 3 comments

Comments

@DigitalLeaves
Copy link

x509 fails to compile / install with NPM.
NPM version: 6.13.1
Node version: v13.3.0
MacOS version: macOS Catalina 10.15.1 (19B88)

Error output:

/Users/XXXX/Library/Caches/node-gyp/13.3.0/include/node/v8config.h:419:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
12 errors generated.
make: *** [Release/obj.target/x509/src/addon.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:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:219:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12)
gyp ERR! System Darwin 19.0.0
gyp ERR! command "/usr/local/Cellar/node/13.3.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/XXXXXX/Projects/XXXXXX/api/node_modules/x509
gyp ERR! node -v v13.3.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Any info you might need, please don't hesitate to ask.

@Barsovich
Copy link

Also fails with the same error with the following.
Node version v12.13.1
npm v6.13.4
MacOS version: macOS Mojave 10.14.6

@DigitalLeaves
Copy link
Author

For other people who might be in this situation and need a fix soon because this code may be in production, there is a library that offers the same functionality: https://github.com/fidm/x509.

We needed a fix ASAP, so we started using it, it is completely Javascript based, so that eliminates the node-gyp disgusting problem with Node 12-13, and not a lot of work is required to adapt your current code to it (the structure of the JSON returned is almost the same).

We have already implemented it and working quite well. If you are in this situation, while you wait for a fix of this amazing library, give it a try.

@gforge
Copy link

gforge commented Sep 7, 2020

I don't think this bug is MacOS specific, similar issue appears in Ubuntu. When running NodeJS 12 and above the below Dockerfile will fail, here is the simplest possible container that I could think of that triggers the error:

FROM ubuntu:20.04

RUN apt-get update && \
  apt-get install curl -y

RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install -y nodejs build-essential

RUN mkdir -p /root/test

WORKDIR /root/test
RUN npm init -y
RUN npm install node-gyp
RUN npm install x509

CMD ["/bin/bash"]

The error does not occur at the RUN npm install node-gyp step but at the RUN npm install x509 that rebuilds the node-gyp package.

For the purpose of this error being easier to Google the main error seems to be these lines:

../../nan/nan_implementation_12_inl.h:356:37: error: no matching function for call to 'v8::StringObject::New(v8::Local<v8::String>&)'
  356 |   return v8::StringObject::New(value).As<v8::StringObject>();
      |                                     ^
In file included from /root/.cache/node-gyp/12.18.3/include/node/node.h:67,
                 from ../include/addon.h:4,
                 from ../src/addon.cc:4:
/root/.cache/node-gyp/12.18.3/include/node/v8.h:5531:23: note: candidate: 'static v8::Local<v8::Value> v8::StringObject::New(v8::Isolate*, v8::Local<v8::String>)'
 5531 |   static Local<Value> New(Isolate* isolate, Local<String> value);
      |                       ^~~
/root/.cache/node-gyp/12.18.3/include/node/v8.h:5531:23: note:   candidate expects 2 arguments, 1 provided
In file included from ../../nan/nan_new.h:189,
                 from ../../nan/nan.h:223,
                 from ../include/x509.h:7,
                 from ../src/addon.cc:5:
../../nan/nan_implementation_12_inl.h:356:58: error: expected primary-expression before '>' token
  356 |   return v8::StringObject::New(value).As<v8::StringObject>();
      |                                                          ^
../../nan/nan_implementation_12_inl.h:356:60: error: expected primary-expression before ')' token
  356 |   return v8::StringObject::New(value).As<v8::StringObject>();

With the end section having looking like this:

make: *** [x509.target.mk:116: Release/obj.target/x509/src/addon.o] Error 1
make: Leaving directory '/root/test/node_modules/x509/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 5.4.0-45-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/test/node_modules/x509
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v5.1.0

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

3 participants