Javascript Node.js 安装:openssl 未安装

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3974707/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 06:57:08  来源:igfitidea点击:

Node.js installation: openssl not installed

javascriptsslubuntunode.jsopenssl

提问by ajsie

I have installed libssl-dev and openssl but I get this when I install node.js:

我已经安装了 libssl-dev 和 openssl,但是当我安装 node.js 时我得到了这个:

> ./configure && make && make install                                                                                          
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                     : not found                                                                                                                  
Checking for function SSL_library_init   : yes                                                                                                                        
Checking for header openssl/crypto.h     : yes                                                                                                                        
Checking for library rt                  : yes                                                                                                                        
Checking for fdatasync(2) with c++       : yes 

Openssl is not found. But node was installed successfully.

找不到 Openssl。但是节点安装成功。

Why isn't openssl found? Anyone has the same problem?

为什么找不到openssl?有人有同样的问题吗?

采纳答案by Conspicuous Compiler

This isn't exactly a programming question. Still...

这不完全是一个编程问题。仍然...

Quick answer

快速回答

The installer checks for OpenSSL support in two ways. The first check failed for you, the second succeeded. For me, the first check succeeded (see below). Either way works.

安装程序以两种方式检查 OpenSSL 支持。第一次检查失败,第二次成功。对我来说,第一次检查成功了(见下文)。无论哪种方式都有效。

Longer answer

更长的答案

Here's what I got when I built it:

这是我构建它时得到的:

$ sudo apt-get install libssl-dev
$ ./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 rt                  : yes 
<---snip--->

Presuming you downloaded node.js v0.2.3from http://nodejs.org/, the configuration is mostly done by wafin the file wscript.

假设您从http://nodejs.org/下载了node.js v0.2.3,配置主要由wscript 文件中的waf完成。

The relevant lines are:

相关线路是:

  if not Options.options.without_ssl:
    if conf.check_cfg(package='openssl',
                      args='--cflags --libs',
                      uselib_store='OPENSSL'):
      Options.options.use_openssl = conf.env["USE_OPENSSL"] = True
      conf.env.append_value("CPPFLAGS", "-DHAVE_OPENSSL=1")
    else:
      libssl = conf.check_cc(lib='ssl',
                             header_name='openssl/ssl.h',
                             function_name='SSL_library_init',
                             libpath=['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/usr/sfw/lib'],
                             uselib_store='OPENSSL')
      libcrypto = conf.check_cc(lib='crypto',
                                header_name='openssl/crypto.h',
                                uselib_store='OPENSSL')

The first part is simple enough. It runs pkgconfig. Here is what happens when I do the equivalent by hand:

第一部分很简单。它运行 pkgconfig。当我手动执行等效操作时会发生以下情况:

 $ pkg-config openssl --cflags --libs
 -lssl -lcrypto  

The second set of checks is run if pkg-config fails to confirm the package is installed. In that case, it tries to compile a trivial gcc program which checks for the existence of functions in libcrypt and libssl. If those both succeed, installation continues. If one of them fails, there's a fatal error, and the script bombs out.

如果 pkg-config 未能确认软件包已安装,则运行第二组检查。在这种情况下,它会尝试编译一个简单的 gcc 程序,该程序检查 libcrypt 和 libssl 中函数的存在。如果两者都成功,安装将继续。如果其中一个失败,则会出现致命错误,并且脚本会爆炸。

回答by Ashwin Bharambe

@weng: I had the same problem. The solution was easy: sudo apt-get install pkg-config :)

@weng:我遇到了同样的问题。解决方案很简单:sudo apt-get install pkg-config :)

回答by joshbennett

I Had the same problem using Debian 6. I had to install libcurl4-openssl-dev.

我在使用 Debian 6 时遇到了同样的问题。我必须安装 libcurl4-openssl-dev。

Switch to root user, or use sudo, then run:

切换到 root 用户,或者使用 sudo,然后运行:

apt-get install libcurl4-openssl-dev

This fixed the problem for me.

这为我解决了问题。

回答by Hal

If using Centos 5.x, make sure that you install openssl-devel prior to ./configure.

如果使用 Centos 5.x,请确保在 ./configure 之前安装 openssl-devel。

yum install openssl-devel

This solved the same issue for me in centos.

这在centos中为我解决了同样的问题。

回答by mindon

  1. confirm your openssl installed.
  2. if installed, confirm its path in ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/usr/sfw/lib'];
  3. if not in those paths, try following options with your correct openssl path ./configure --openssl-libpath=/usr/local/ssl/lib --openssl-includes=/usr/local/ssl/include
  1. 确认您安装了 openssl。
  2. 如果已安装,请确认其路径['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/usr/sfw/lib']
  3. 如果不在这些路径中,请尝试使用正确的 openssl 路径执行以下选项 ./configure --openssl-libpath=/usr/local/ssl/lib --openssl-includes=/usr/local/ssl/include

回答by mikermcneil

Seems like I can do:

好像我可以这样做:

apt-get install lib32z1-dev
apt-get install pkg-config

to consistently remove all errors and warnings about openssl when I'm doing a fresh Rackspace deployment with Ubuntu 11.04 or 11.10, in case that helps anyone else out.

当我使用 Ubuntu 11.04 或 11.10 进行全新的 Rackspace 部署时,始终删除有关 openssl 的所有错误和警告,以防对其他人有所帮助。

Here's a gist with a rundown of the script I finally settled on for spinning up these types of instances with node.js:

这是我最终决定使用 node.js 启动这些类型的实例的脚本概要的要点:

https://gist.github.com/1606102

https://gist.github.com/1606102

Edit: Updated the gist to reflect the updates made to Node, etc.

编辑:更新了要点以反映对节点等所做的更新。

回答by chatfeed

I had the same problem.

我有同样的问题。

I tried

我试过

./configure --prefix=/opt/node --openssl-libpath=/usr/local/lib/

which solved it even though I think --openssl-libpath=/usr/local/lib/isn`t necessary

即使我认为没有--openssl-libpath=/usr/local/lib/必要也解决了它

回答by bithavoc

To solve this issue in Ubuntu 12.04:

要在 Ubuntu 12.04 中解决此问题:

apt-get install pkg-config -y

回答by j03m

sudo apt-get install g++ curl libssl-dev apache2-utils

sudo apt-get install g++ curl libssl-dev apache2-utils

回答by Bouncner

For people with a new Debian 6.0 (to be more precise: Debian 6.0.2.1 i386) set up, the following packages need to be installed to run node.js v.0.6.15 (latest stable at the moment): - build-essentials - pkg-config - libssl-dev

对于安装了新 Debian 6.0(更准确地说:Debian 6.0.2.1 i386)的人,需要安装以下软件包才能运行 node.js v.0.6.15(目前最新稳定版):- build-要点 - pkg-config - libssl-dev

Just use aptitude -y install "package" ... hope that helps for all you Debian guys. :)

只需使用 aptitude -y install "package" ... 希望对你们所有的 Debian 人都有帮助。:)