BREW安装nginx的失败链接(brew install nginx fails to link)

2019-08-01 00:19发布

我试图安装使用BREW包管理器nginx的,但它无法链接。 我怎样才能解决这个问题?

roc-web5537:Downloads cmuench$ brew install nginx
Warning: Your Xcode (4.3.3) is outdated
Please install Xcode 4.5.
==> Installing nginx dependency: pcre
==> Downloading ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.bz2
Already downloaded: /Library/Caches/Homebrew/pcre-8.31.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/pcre/8.31 --enable-utf8 --enable-unicode-properties --enable-pcregrep-libz --enable-pcregrep-libbz2
==> make test
==> make install
Warning: Could not link pcre. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link pcre'
==> Summary
/usr/local/Cellar/pcre/8.31: 130 files, 3.2M, built in 18 seconds
==> Installing nginx
==> Downloading http://nginx.org/download/nginx-1.2.4.tar.gz
Already downloaded: /Library/Caches/Homebrew/nginx-1.2.4.tar.gz
==> Patching
patching file conf/nginx.conf
==> ./configure --prefix=/usr/local/Cellar/nginx/1.2.4 --with-http_ssl_module --with-pcre --with-ipv6 --with-cc-opt=-I/usr/local/include --with-ld-opt=-L/usr/local/lib --conf-path=/usr/loca
==> make
==> make install
==> Caveats
In the interest of allowing you to run `nginx` without `sudo`, the default
port is set to localhost:8080.

If you want to host pages on your local machine to the public, you should
change that to localhost:80, and run `sudo nginx`. You'll need to turn off
any other web servers running port 80, of course.

You can start nginx automatically on login running as your user with:
  mkdir -p ~/Library/LaunchAgents
  cp /usr/local/Cellar/nginx/1.2.4/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/
  launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

Though note that if running as your user, the launch agent will fail if you
try to use a port below 1024 (such as http's default of 80.)
Warning: Could not link nginx. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link nginx'
Warning: /usr/local/sbin is not in your PATH
You can amend this by altering your ~/.bashrc file
==> Summary
/usr/local/Cellar/nginx/1.2.4: 9 files, 952K, built in 9 seconds

Answer 1:

我有这个问题,前几天与安装自耕农。 看来,一些在/ usr /本地文件夹的可能不是由你所拥有,并可能会导致问题。 在我来说,我有一对夫妇的文件夹在/ usr /本地/这样。

进入到/ usr /本地

cd /usr/local

检查谁拥有的文件夹

ls -l

请执行下列操作不归您所有的文件夹(替换子文件夹名称与子文件显然名称):

sudo chown $(whoami) /usr/local/<sub-foldername>

然后调用

brew link pcre

它应该成功链接。

希望这可以帮助。



Answer 2:

这有时会发生,如果有地区已经文件(或符号连接)具有相同的名称。 要强制一个链接,你可以使用brew link -f pcre 。 如果你想看看是否有任何阻止链接文件,你可以使用brew link --dry-run pcre

如果没有上市文件brew link --dry-run pcre ,那么很可能jwwishart的答案是正确的。



Answer 3:

我不得不手动删除并重新安装PCRE和OpenSSL然后nginx的将工作:

brew remove pcre
brew remove openssl
brew install pcre
brew install openssl
nginx


文章来源: brew install nginx fails to link
标签: homebrew