robertklep / node-metrohash

Node.js bindings for MetroHash
MIT License
26 stars 8 forks source link

gyp build error on Windows 10 #12

Closed MarcusCemes closed 5 years ago

MarcusCemes commented 5 years ago

Hi, I'm getting a build error on both Node 10 LTS and 11 (latest), Windows 10 Pro.

I have Python 3.7.0 installed on my system, could the install script be conflicting with the "new" version of Python that I have installed?

I thought this might be related to #5, but the error is different if somewhat related. Should I raise this issue with node-gyp or is this related to the build script of node-metrohash?

λ npm i metrohash

> metrohash@2.5.1 install C:\Users\Marcus\Development\responsive-image-builder\node_modules\metrohash
> node-gyp rebuild

C:\Users\Marcus\Development\responsive-image-builder\node_modules\metrohash>if not defined npm_config_node_gyp (node "C:\Users\Marcus\AppData\Roaming\nvm\v11.12.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\Marcus\AppData\Roaming\nvm\v11.12.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\Marcus\AppData\Local\Programs\Python\Python37-32\python.EXE -c
import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:297:12)
gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:988:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Marcus\\AppData\\Roaming\\nvm\\v11.12.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Marcus\Development\responsive-image-builder\node_modules\metrohash
gyp ERR! node -v v11.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! metrohash@2.5.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the metrohash@2.5.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Many thanks!

robertklep commented 5 years ago

Sadly, the only solution is to install, or revert back to, Python 2, as Python 3 isn't supported by node-gyp:

Install Python 2.7 (v3.x.x is not supported)

(ref)

MarcusCemes commented 5 years ago

That is unfortunate. Thanks for looking into it, it seems that I will be using MD5 for now.

robertklep commented 5 years ago

I have both Python 2 and Python 3 installed on my systems, although those are running either macOS or Linux. I would assume that something similar is also possible on Windows, but I have no experience on that subject :(

FWIW, there are plenty of other fast non-cryptographic hashes available for Node.js: xxhash, murmur, farmhash. I'm not sure if those will work without node-gyp, though.

wedneyyuri commented 3 years ago

Sadly, the only solution is to install, or revert back to, Python 2, as Python 3 isn't supported by node-gyp:

Install Python 2.7 (v3.x.x is not supported)

(ref)

@robertklep python 2 is no longer supported, and recent versions of node-gyp already support python 3. What do you think about python 3 support?

robertklep commented 3 years ago

@wedneyyuri I'm dependent on node-gyp and what it supports (or doesn't). That said, I assume that it will support Python 3 nowadays, so I'll look into it 😊

robertklep commented 3 years ago

Just published metrohash@2.8.0 which uses the latest of everything.