Closed loretoparisi closed 4 years ago
[UPDATE] According to this SF question this issue maybe related when using Python 3.x instead of Python 2.7 when on macOS If this is the case, how to make node-gyp to use the old version of python. When on macOS we now have python 3.7.7 with brew by defaults, so my workaround was:
brew install python@2 (if for some crazy reason it was removed, very unlikely
brew link python@2
or to force the latter brew link --overwrite --dry-run python@2
and then you should get both python
(python2) and python3
installed.
It's important to notice the since node-gpy
still requires python
to be Python2.7 you need also to specify the right library path, then you may want to alias it in .bash_profile
:
function __py3 {
export PYTHONPATH=/usr/local/lib/python3.7/site-packages/
}
function __py2 {
export PYTHONPATH=/Library/Python/2.7/site-packages
}
alias py3='__py3'
alias py2='__py2'
My two cent. Why node-gyp does not upgrade to Python3?
You have two different node-gyp
installed... v6.0.1 and v5.0.5 (see the error log).
Please upgrade gyp ERR! node-gyp -v v5.0.5
to https://github.com/nodejs/node-gyp/releases
@cclauss thanks, I can only see
ip-192-168-1-168:Projects loretoparisi$ which node-gyp
/usr/local/bin/node-gyp
ip-192-168-1-168:Projects loretoparisi$ node-gyp --version
v6.0.1
Please look through your log above:
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v5.0.5
@cclauss thank you. So if I do a locate node-gyp
I cannot find the offender version v5.0.5
under path like
/usr/local/n/versions/node/
/usr/local/lib/node_modules/npm/node_modules/node-gyp
/usr/local/Cellar/node/
/Users/loretoparisi/.node-gyp/
etc.
/Users/loretoparisi/Documents/Projects/node_modules/node-gyp/gyp ?
while I have all these (not sure why actually!)
/Users/loretoparisi/.node-gyp/
10.0.0/ 10.1.0/ 10.15.3/ 11.1.0/ 6.9.4/ 8.11.1/ 8.11.2/ 8.12.0/ 8.9.1/ 8.9.4/ 9.11.1/
I think I have found it here
/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp --version
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
since it crashes and it is linked to Python2. Do you think is the right one? Under setup.py
I can see
ip-192-168-1-168:pose-animator loretoparisi$ cat /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/setup.py
#!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from setuptools import setup
setup(
name='gyp',
version='0.1',
description='Generate Your Projects',
author='Chromium Authors',
author_email='chromium-dev@googlegroups.com',
url='http://code.google.com/p/gyp',
package_dir = {'': 'pylib'},
packages=['gyp', 'gyp.generator'],
entry_points = {'console_scripts': ['gyp=gyp:script_main'] }
)
hey @loretoparisi :)
I ran into this issue myself -- turns out I just needed to updated NPM itself (which has node-gyp
as a dependency)
npm i -g npm
Thanks @wulf, npm i -g npm
fixed this for me! (I'm using node v11.15.0 on Darwin 19.6.0)
@Wulf great, thank you! in fact it worked with node v12.16.1
, npm v6.13.4
, node-gyp v6.0.1
. Closing then.
I'm getting this error with latest
nodehun
nodehun@3.0.1
while building on macOS 10.14.5 (Darwin 18.6.0)It seems to me that this is related to node-gyp rather than this module itself.