Tag Archives: homebrew

[Solved] Mac Install homebrew Error: error: Not a valid ref: refs/remotes/origin/master

The MAC reports the following error after installing homeberw:

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /usr/sbin/chown -R aa:admin /opt/homebrew
==> Downloading and installing Homebrew...
HEAD is now at 8de10a05b Merge pull request #10472 from MikeMcQuaid/new-issue-templates
error: Not a valid ref: refs/remotes/origin/master
fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error: Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-core failed!
fatal: invalid upstream 'origin/master'
Failed during: /opt/homebrew/bin/brew update --force --quiet

The solution is as follows:

Uninstall homebrew

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

Set git compression:

git config --global core.compression 0

Set git buffer size:

git config --global http.postBuffer 1048576000

Reinstall brew

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

The server just without updating PID file and can’t connect to local MySQL server through socket are solved

1. Report an error when logging into mysql

$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

This error occurs because MySQL has not been started. To verify this guess, you can turn on the activity monitor and search mySQld, which cannot be found. Since I took the screenshot after fixing the problem myself, the mySQld process was already started when I searched.

Or type a command to view mysql.server Status

$ mysql.server status
/usr/local/mysql/support-files/mysql.server: line 365: pidof: command not found
 ERROR! MySQL is not running

As you can see, MySQL is not running. Since MySQL isn’t running, we definitely need to start MySQL.
Second, MySQL startup also reported an error

$mysql.server start
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/XXXX.local.pid).

The boot report is wrong, is the permission not enough?So first change the permissions of /usr/local/var/mysql

sudo chown -R _mysql:mysql /usr/local/var/mysql

Once the permissions are resolved, test it with SUdo and restart it
3. Start sudo

$ sudo mysql.server start
Password:
Starting MySQL
.. SUCCESS! 

Surprisingly, MySQL started successfully, and then logged in again

$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.21-log Homebrew

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Summary: The problem of Can’t connect to local MySQL Server through socket is caused by MySQL not being started. The Server Quit without updating The PID file is due to permissions problem, which is solved and The first problem is solved accordingly.
Of course, due to different environment configuration and different installation methods, there will be some differences in the solution, but the cause of the problem should be the same. I am a Mac, homebrew installed mysql, through this method, successfully solved the problem.
Refer to the information on StackOverflow:
MySql server startup error ‘The server quit without updating PID file ‘
For a newbie: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
 

brew install node Error: No such file or directory @ dir_chdir Bottle installation failed

Enter the brew installation node in the terminal and the carriage return error is shown below.

brew installation node
==>Dependencies on the installation node:icu4c
==>Installation node dependency:icu4c
==>
Downloaded:
/Users/lvhongjian/Library/Caches/Homebrew/downloads/ 2ac5137342effaf79e199fb1612ebce7842df443578bcd61afd73767858aef – icu4c-62.1. mojave.bottle.tar>gz
Error: no such file or directory @ dir_chdir – /usr/local/Cellar
Warning: bottle installation failed: build from source.
== than; Downloaded:
/Users/lvhongjian/Library/ cache /Homebrew/downloads/ b79f5dd51110fb1096e57fc35ba03df84f69142b0374bae8a0381edde5a80448-icu4c-62_1- src. tgz
Error:An exception occurred in a subprocess:Errno::EPRM:
Operation not allowed @ dir_s_mkdir – /usr/local/Cellar
solution

As the log in user is not a HomeBrew installer, the above error is solved as follows.
1. reinstall HomeBrew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" on the current user.
2. run brew install node prompt successful