qrohlf / trianglify

Algorithmically generated triangle art
http://qrohlf.com/trianglify/
GNU General Public License v3.0
10.08k stars 669 forks source link

Unable to install trianglify on node 8.11.4 #99

Closed wisyr closed 5 years ago

wisyr commented 5 years ago

While installing trianglify on node (ver 8.11.4) for Server Side Rendering purposes, I'm getting numerous warnings and errors in the console, related with e.g. node-pre-gyp, node-gyp etc. It happens in linux console. However it works properly locally, on node 8.11.1 on windows.

/usr/include/machine/pcb.h:58:2: error: unknown type name 'register_t'; did you
      mean '__register_t'?
        register_t      pcb_rbx;        /* (*) */
        ^
/usr/include/x86/_types.h:108:19: note: '__register_t' declared here
typedef __int64_t       __register_t;
                        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
gmake: *** [canvas.targ

node-pre-gyp ERR! node -v v8.11.4
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok

Is it the fault of the dependencies, which trianglify is using? LF solution.

Currently I'm unable to use this lib in my project, unfortunately.

qrohlf commented 5 years ago

If you're using this for SSR, I assume you're going to be outputting SVG rather than <canvas>, right?

This looks like an issue with the node-canvas dependency, which is only needed if you're trying to render to <canvas> or PNG. If you're outputting to SVG, just don't install node-canvas and you should be fine.

If this is happening without the canvas package in your dependencies list, then I'm going to need more information about the specific OS version you're trying to install on so I can attempt to reproduce.

wisyr commented 5 years ago

I did a workaround. Since I'm not using trianglify on server side, I have made a conditional import using require. If client, require trianglify, if server - do not import anything.

And actually it worked. One more thing though - the dependency on server side has to be placed inside devDependencies, else it will drop the npm install with multiple errors.

P.S. Thank you for an outstanding library. This is a pure gold.