gpt4 book ai didi

node.js - Mac安装openssl,环境找不到

转载 作者:太空宇宙 更新时间:2023-11-03 23:19:11 43 4
gpt4 key购买 nike

我已经安装了openssl,当我输入openssl时,命令行可以识别它。但是我的 Node 配置找不到它。

看下面的图片

enter image description here

我尝试在 .bash_profile 中添加路径

并尝试此 one 中的一些提示但它们都不起作用

最佳答案

如果您使用 brew 安装了 openssl,您可能需要设置 LDFLAGSCPPFLAGS,来自:

brew info openssl

This formula is keg-only, which means it was not symlinked into /usr/local, because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig

如果您尝试链接,您将收到如下警告:

$ brew link --force openssl
Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib

您可以做的是创建一个符号链接(symbolic link),以便编译器可以找到这些库:

$ ln -s /usr/local/opt/openssl/include/openssl /usr/local/include

这应该允许您编译node-v0.6.1:

$ ./configure
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for program gcc or cc : /usr/bin/gcc
Checking for gcc : ok
Checking for library dl : yes
Checking for openssl : yes
Checking for library util : yes
Checking for library rt : not found
Checking for fdatasync(2) with c++ : no
'configure' finished successfully (0.998s)

关于node.js - Mac安装openssl,环境找不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51700093/

43 4 0
文章推荐: opencv - u-disparity 显示预期 cols 的一半
文章推荐: c# - 如何使用 Roslyn 独立分析从别名获取类型
文章推荐: c# - 当 T 是对象的后代时,为什么不能将 Predicate 分配给 Predicate