Continue with package installation if node-gyp fails

48 views
Skip to first unread message

Pascal Mathis

unread,
Jul 11, 2014, 2:55:08 PM7/11/14
to nod...@googlegroups.com
Hello everyone

I am currently trying to offer an optional native library for my own Node.js package. My library actually works 6+ (up to 20, didn't test further) times faster than with the plain JS implementation. The drawback: It requires libcrypto++-dev, otherwise the build will fail. Also, it will not work on Windows operating systems. What I am trying to do is to make the node-gyp build process optional, so that npm would continue with installing the package, even if node-gyp fails. Is there any way to do that? I've already looked through various example gyp-files and stumbled upon some documentations, but was not able to find a solution.

Thanks in advance for your answer and have a nice evening!

Best regards
Pascal

Elijah Insua

unread,
Jul 12, 2014, 12:03:56 AM7/12/14
to nod...@googlegroups.com


--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/13272d96-7d7e-4432-91a2-ded5eaffbe98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pascal Mathis

unread,
Jul 12, 2014, 6:06:22 AM7/12/14
to nod...@googlegroups.com
Thanks for your answer, Elijah. I know that already, but I would rather prefer to -not- split my native library into a new package. It is just a single .cpp & binding.gyp file and I don't like the idea of having 2 separate repositories. Thats why I was looking for any sort of option which would tell npm: "Hey, node-gyp failed, it doesn't matter, the package is still fine." Is there anything like that?

Tom Boutell

unread,
Jul 12, 2014, 11:28:27 PM7/12/14
to nod...@googlegroups.com
I believe the BSON npm package achieves this. If it can't go native it offers up a pure js implementation instead.

Ryan Graham

unread,
Jul 13, 2014, 11:50:35 AM7/13/14
to nodejs

I think you're looking for something like this:

"install": "node-gyp rebuild || exit 0"

Putting that in the scripts section of your module's package.json will prevent the installation of the module from failing just because node-gyp fails.

~Ryan
https://twitter.com/rmgraham

--
Reply all
Reply to author
Forward
0 new messages