Tag Archives: gyp

[solution] MAC: stack error: ` gyp ‘failed with exit code:1

[20200730 update]
at the bottom is the previous answer. I found this problem was not so simple, because searching gypfailed with exit code:1 was not specific enough, look at the error reported, in fact, it could be more detailed. Separator before the following is a solution, this solution can only solve the file node - gyp/lib/configure. Js: 305:16 fault, if it is the problem on the bottom of the reference solution. If not, take a closer look at your problem, and sometimes you'll find that another problem is the following:

ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
...
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
...
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found
...
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py", line 152, in <module>
    _new_sha1 = hashlib.sha1
AttributeError: 'module' object has no attribute 'sha1'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 19.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/eric/Desktop/admin-web/node_modules/watchpack-chokidar2/node_modules/fsevents
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

look at this problem, mainly is the /usr/local/Cellar/python @ 2/2.7.15/Frameworks/python framework Versions/2.7/lib/python2.7/hashlib. Py this file was wrong, and wrong is md5 and sha1 encryption methods, such as didn't find it. So the file problem, should be caused by our computer environment, the computer is certain that a library in addition to the problem, resulting in the execution of this file and encryption related libraries or methods are suspended. So when searching, you can search MAC ERROR:root:code for hash md5 was not found or something like that, and search on bing.com international version, so that if there are related questions on StackOverflow, you can see them directly. Sure enough, there's a problem here, the same thing that we had, and the main reason is that the openssl on our computer is not working. Maybe it's because we've installed multiple versions of Python, or maybe we've installed some software that comes with OpensSL that conflicts with the computer's own. So that's this guy. So, we need to respecify that.

# 先看看是什么版本,我的是1.0.2o_1
ls /usr/local/Cellar/openssl
# 指定切换到这个版本
brew switch openssl 1.0.2o_1
# 输出以下这样的就成功了
Cleaning /usr/local/Cellar/openssl/1.0.2o_1
Opt link created for /usr/local/Cellar/openssl/1.0.2o_1

1. Problem description

NPM installation error, all kinds of online uninstall and reinstall node-gyp methods have been tried to no use, but can not find the root of the problem:

gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.0.0
gyp ERR! command "/usr/local/Cellar/node/8.1.3/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/project/node_modules/ckmeans
gyp ERR! node -v vxx
gyp ERR! node-gyp -v vxxx
gyp ERR! not ok 

2, cause guess

gyp is a compilation tool, similar to the makefile command, it is mainly used to compile C++, node integrated it, called node-gyp0.

NPM is the source code for , NPM install is pull the source code in native compilation, after this time because inevitably, the source code used in other languages, such as C or C + +, compile time, so you need to other language compiler tools such as node - gyp , but the fact is that these compile tools in different systems is dependent on different system compiler tools, For example, on the MAC, this node-gyp actually relies on the compilation tools provided by xcode, so that's the problem I ran into. It's a xcode tool. Except for the problem, the tool management of xcode is xcode-select, which needs to be reset or installed or reset.

3. Solution

for the specific solution, see an issue of schnerd/d3-scale-cluster:

# 要不要sudo看自己当前用户是不是有sudo权限
$ [sudo] xcode-select --install
xcode-select: error: command line tools are already installed, 
use "Software Update" to install updates

# 提示已经安装的话,就重置
[sudo] xcode-select --reset

problem solved.

gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildPr

骗取犯错!建立错误
gyp ERR!堆栈错误:make failed with exit code: 2
gyp ERR!在ChildProcess堆栈。onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR!在ChildProcess堆栈。emit (events.js:182:13)
gyp ERR!在Process.ChildProcess._handle堆栈。onexit (internal/child_process.js:239:12)
gyp ERR达尔文系统16.7.0
gyp ERR!命令“/ usr /地方/地窖/节点/ 10.9.0/bin /节点”“/ usr /地方/ lib/node_modules/npm node_modules/node-gyp/bin/node-gyp。js ” “重建” gyp ERR!cwd /Users/zhangying/Documents/www/kurento/kurento-client-js/node_modules/utf-8-validate gyp ERR!node-gyp -v v3.8.0
不ok
npm WARN [email protected]需要一个对等的grunt@~0.4.1,但没有安装。您必须自己安装对等依赖。

npm犯错!代码ELIFECYCLE
npm ERR!ERR!
npm [email protected]安装:node-gyp rebuild
npm ERR!退出状态1
npm ERR!
npm犯错!安装脚本[email protected]失败。
npm犯错!这可能不是npm的问题。上面可能有额外的日志输出

npm犯错!此运行的完整日志可在以下文件中找到:
npm ERR!/用户/ zhangying/.npm/_logs/2018 – 09 – 08 – t03_07_51_380z debug.log

方法一:
npm安装- g bcrypt
方法二:
删除~ /。node-gyp
方法三:
切换到当前项目下即可。

rm射频.node-gyp/

npm install -g node-gyp

rm射频项目/ node_modules

再次,npm安装即可。