我现在已经尝试了大部分的方法,所以我迫切需要一些帮助。我已经尝试重新安装了laravel贴身服务。我也曾尝试重新安装brew,但总是出现相同的错误。
当我运行brew services list
时,我得到:
▶ brew services list
Name Status User Plist
dnsmasq unknown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
nginx error root /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
php started root /Library/LaunchDaemons/homebrew.mxcl.php.plist
如您所见,nginx上有一个错误。当我运行sudo /usr/local/opt/nginx/bin/nginx -g 'daemon off;'
时,我得到以下输出:
nginx: [emerg] bind() to 127.0.0.1:80 failed (48: Address already in use)
nginx: [emerg] bind() to 127.0.0.1:80 failed (48: Address already in use)
nginx: [emerg] bind() to 127.0.0.1:80 failed (48: Address already in use)
nginx: [emerg] bind() to 127.0.0.1:80 failed (48: Address already in use)
nginx: [emerg] bind() to 127.0.0.1:80 failed (48: Address already in use)
nginx: [emerg] still could not bind()
所以看起来好像有另一个nginx进程以某种方式启动了?当我运行sudo lsof -i tcp:80
时,我得到这样的结果:
▶ sudo lsof -i tcp:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 71557 root 6u IPv4 0xb2e487bcf1edb7ad 0t0 TCP localhost:http (LISTEN)
nginx 71558 margul 6u IPv4 0xb2e487bcf1edb7ad 0t0 TCP localhost:http (LISTEN)
nginx 71559 margul 6u IPv4 0xb2e487bcf1edb7ad 0t0 TCP localhost:http (LISTEN)
nginx 71560 margul 6u IPv4 0xb2e487bcf1edb7ad 0t0 TCP localhost:http (LISTEN)
nginx 71561 margul 6u IPv4 0xb2e487bcf1edb7ad 0t0 TCP localhost:http (LISTEN)
nginx 71562 margul 6u IPv4 0xb2e487bcf1edb7ad 0t0 TCP localhost:http (LISTEN)
nginx 71563 margul 6u IPv4 0xb2e487bcf1edb7ad 0t0 TCP localhost:http (LISTEN)
nginx 71564 margul 6u IPv4 0xb2e487bcf1edb7ad 0t0 TCP localhost:http (LISTEN)
nginx 71565 margul 6u IPv4 0xb2e487bcf1edb7ad 0t0 TCP localhost:http (LISTEN)
nginx 71567 margul 6u IPv4 0xb2e487bcf1edb7ad 0t0 TCP localhost:http (LISTEN)
nginx 71568 margul 6u IPv4 0xb2e487bcf1edb7ad 0t0 TCP localhost:http (LISTEN)
nginx 71569 margul 6u IPv4 0xb2e487bcf1edb7ad 0t0 TCP localhost:http (LISTEN)
nginx 71571 margul 6u IPv4 0xb2e487bcf1edb7ad 0t0 TCP localhost:http (LISTEN)
如果我在做ps aux | grep "nginx"
,我会得到这样的结果:
▶ ps aux | grep "nginx"
margul 71571 0,0 0,0 4319864 1352 ?? S 11:21pm 0:00.00 nginx: worker process
margul 71569 0,0 0,0 4314744 1368 ?? S 11:21pm 0:00.00 nginx: worker process
margul 71568 0,0 0,0 4333176 1420 ?? S 11:21pm 0:00.00 nginx: worker process
margul 71567 0,0 0,0 4313720 1340 ?? S 11:21pm 0:00.00 nginx: worker process
margul 71565 0,0 0,0 4315768 1408 ?? S 11:21pm 0:00.00 nginx: worker process
margul 71564 0,0 0,0 4325252 2024 ?? S 11:21pm 0:00.00 nginx: worker process
margul 71563 0,0 0,0 4331128 1396 ?? S 11:21pm 0:00.00 nginx: worker process
margul 71562 0,0 0,0 4331128 1360 ?? S 11:21pm 0:00.00 nginx: worker process
margul 71561 0,0 0,0 4313720 1372 ?? S 11:21pm 0:00.00 nginx: worker process
margul 71560 0,0 0,0 4321912 1388 ?? S 11:21pm 0:00.00 nginx: worker process
margul 71559 0,0 0,0 4330104 1380 ?? S 11:21pm 0:00.00 nginx: worker process
margul 71558 0,0 0,0 4320888 1408 ?? S 11:21pm 0:00.00 nginx: worker process
root 71557 0,0 0,0 4293560 612 ?? Ss 11:21pm 0:00.00 nginx: master process nginx
margul 97215 0,0 0,0 4277664 752 s001 R+ 12:11am 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox nginx
我已经用完了可以尝试的东西,而且我即将重新安装MacOS,这将是疯狂的,仅仅是为了让Laravel valet正常工作。正如我所说的,我已经多次尝试以各种不同的方式卸载Laravel valet,重启、停止nginx服务、卸载brew。
如果有人能给我指出正确的方向,那就太棒了。
发布于 2021-07-15 15:43:17
已通过更新xcode解决此问题(运行brew doctor
时,请确保显示"Ready to brew")。然后我使用命令/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
删除了卸载的brew。然后,我通过执行sudo -rf /usr/local/*
删除了/usr/local
中的所有内容,以确保我已经从brew中删除了所有内容。
完成此操作后,我使用最新的xcode重新安装了brew,然后再次重新安装了laravel valet,它起作用了。当我运行brew services list
时,它仍然在nginx上显示错误,但现在它可以工作了。
▶ brew services list
Name Status User Plist
dnsmasq unknown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
nginx error root /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
php started root /Library/LaunchDaemons/homebrew.mxcl.php.plist
https://stackoverflow.com/questions/68385662
复制相似问题