在安装好nginx之后,运行nginx
,报错:
nginx
dyld: Library not loaded: /usr/local/lib/libpcre.1.dylib
Referenced from: /usr/local/bin/nginx
Reason: image not found
我们可以通过brew doctor来查看具体的出现的问题。
brew doctor
结果得到如下信息:
Warning: You have unlinked kegs in your Cellar Leaving kegs unlinked can lead to build-trouble and cause brews that depend on those kegs to fail to run properly once built. Run `brew link` on these: pcre
然后执行:
brew link
之后又出现错误的提示如下:
brew link pcre Linking /usr/local/Cellar/pcre/8.36... Error: Could not symlink share/man/man3/pcre.3 /usr/local/share/man/man3 is not writable.
最后在网上找到如下解决方案:
sudo chown -R 用户名 /usr/local/share/man/man3
接下来,在link操作就可以啦:
brew link pcre
哈哈,这样就可以成功运行nginx啦。
可以通过localhost:8080进行查看。
结果如下:
时间: 2024-11-05 22:01:38