Closed lukehedger closed 4 years ago
Not sure that I understand question. Are we use node-gyp
in wrong way?
@lukehedger is right
npm install keccak
fails when trying to build it with node-gyp. It also try to find python executable in order to build it.
@maxpaynestory can you explain?
When i do
npm install keccak
during installation keccak try to build it with node-gyp
node-gyp rebuild
and it fails giving the following error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
It seems like build process use python which is not available on my machine.
@maxpaynestory changing node-gyp rebuild
to node-gyp install
will not fix your issue. If you want compiled bindings you should setup your environment. If you use windows, this should be helpful: https://github.com/cryptocoinjs/secp256k1-node#windows
@fanatid I think the OP is referring to the fact that you need to rebuild keccak
every time you install it.
I don't know much about node-gyp
and its ecosystem, but I looked around to see how other projects handle this. Most of them seem to use node-pre-gyp
(for example, nodegit
, node-libcurl
, node-sqlite3
, etc.). From what I can tell, this builds the module for several platforms and uploads it somewhere (S3 by default) and then, when someone installs the module, it checks if the binary for the user's platform is available for download. If it's not, then it's compiled with node-gyp
.
node-sass
doesn't use node-pre-gyp
, but apparently it does something similar, using GitHub releases as the binary repository.
Sorry if you already knew all of this, but it might be useful if you didn't :slightly_smiling_face:
We had prebuild binaries in the past, but then it was removed (as possible security vulnerability).
That makes sense, thanks! It's a pity, since this adds some friction when installing web3
, but if it can't be helped security-wise, then I guess it's just the way it is.
I added prebuild/node-gyp-build, so addon building should not be run often. (will be run only if prebuilds not exists)
Just wondering the reason behind running
node-gyp rebuild
on theinstall
hook? This makes an install of the library pretty intensive so sure there is a sound reason behind it but be good to understand this. Thanks!https://github.com/cryptocoinjs/keccak/blob/master/package.json#L34