Tag Archives: mac

[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.

Mac install yarn 2020-10-18

brew install yarn 

if the save Failed to connect to port 443 raw.githubusercontent.com: Connection refused, because no Homebrew

normally installs Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

but due to some of the you understand factors, lead to a lot of raw.githubusercontent.com DNS has been polluted.

solution

is solved directly using this open source script with one click:

https://gitee.com/cunkai/HomebrewCN

Homebrew domestic automatic installation script

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

is then loaded with yarn

brew install yarn

Installation and use of graphviz under mac

1. Install
Graphviz http://www.graphviz.org/
MAC users recommend to install directly with homebrew, the official version is older

1. Install homebrew
open the terminal to copy and paste the following command:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After homebrew is installed, run brew install Graphviz to

Brew: command not found
= bash: brew: command not found

terminal input sudo vim.bash_profile ,
input I to enter the input mode,
add export PATH="/usr/local/bin:$PATH",
press esc to exit the input mode,
enter :wq to exit and save
finally enter source.bash_profile to make the configuration take effect.
(note that : and Spaces are also entered, bash_profile may be saved with a warning, :w! force can be saved, more vim command reference http://www.cnblogs.com/usergaojie/p/4583796.html)

2. Use
for a random example:
1. Use the text editor (sublime in this case) to type the following:

digraph pic { 
  Hello -> World
}

3. Open the terminal and switch to the directory where the dot file is located, enter dot pic.dot-t png-o pic.png
4. You can see that a pic.png file

has been generated under the dot file directory

>
>
>
>
>
>
>
>
>
>
>
>
https://blog.zengrong.net/post/2294.html
https://zhuanlan.zhihu.com/p/22820399

Solving ora-21561: oid generation failed

the article source: http://blog.csdn.net/elonlink/article/details/52635523

yesterday after updating macOS Sierra, it was found that Navicat connection Oracle ora-21561: OID generation failed error

solution

  • open the terminal and check hostname
<code class="hljs  has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">hostname</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

finds local instead of localhost

View the hosts file

<code class="hljs bash has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">cd</span> /etc  
open hosts</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>

is

<code class="hljs vala has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">##</span>
<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;"># Host Database</span>
<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">#</span>
<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;"># localhost is used to configure the loopback interface</span>
<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;"># when the system is booting.  Do not change this entry.</span>
<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">##</span>
<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">127.0</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.0</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.1</span>   localhost
<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">255.255</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.255</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.255</span> broadcasthost
::<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>             localhost </code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li></ul>
  • problem has been found, because the hostname is not the same as the hostname in the hosts file
  • solution, change the hostname to be the same as the hostname
<code class="hljs bash has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> scutil --set HostName localhost</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

Reconnect Oracle

MacBook Pro battery 0%, connected to the power but showed that the battery is not charging solution

blogger MBP just bought, there was a situation of not charging, almost scared to death, summed up the online solution to solve the problem, in order to prevent the next time similar problems, first recorded:

Connect the power adapter to the power supply and the MBP.

  • on the internal keyboard, press the left Shift+Control+Option key and power button
  • simultaneously release all the keys and power button
  • open the computer and find the problem solved, thank god ~~
  • About solving the problem that vscode files cannot be edited

    many times when we use VSCode to open a file sent by someone else or modify a configuration file, we will find that the file cannot be modified.

    does not mean that files cannot be modified, but VSCode editing adopts the mode similar to Vim editor. Only when you type I can you modify. After the modification is completed, you can type Command+S(MacOS) or Control+S(Windows) is unable to save.

    detailed usage of the vim editor can be seen in [MIT open class (a missing lesson in computer education)]3. Editor (Vim).