【问题标题】:Dependencies error at the time of installing nodejs.rpm using rpm in Centos 7?在 Centos 7 中使用 rpm 安装 nodejs.rpm 时出现依赖关系错误?
【发布时间】:2019-09-11 17:27:33
【问题描述】:

我正在尝试使用 rpm 安装程序在 Centos 7 中安装 nodejs.rpm。引用此link。从参考链接here下载的rpm二进制包。

下载的文件在我的本地目录中可用。然后执行以下命令

rpm -ivh nodejs-10.13.0-2.el7.x86_64.rpm

出现以下错误

warning: nodejs-10.13.0-2.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID ac25decd: NOKEY
error: Failed dependencies:
    http-parser >= 2.7.0 is needed by nodejs-1:10.13.0-2.el7.x86_64
    libcrypto.so.1.1()(64bit) is needed by nodejs-1:10.13.0-2.el7.x86_64
    libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) is needed by nodejs-1:10.13.0-2.el7.x86_64
    libhttp_parser.so.2()(64bit) is needed by nodejs-1:10.13.0-2.el7.x86_64
    libnghttp2.so.14()(64bit) is needed by nodejs-1:10.13.0-2.el7.x86_64
    libnghttp2_14_17_1 >= 1.34.0 is needed by nodejs-1:10.13.0-2.el7.x86_64
    libssl.so.1.1()(64bit) is needed by nodejs-1:10.13.0-2.el7.x86_64
    libssl.so.1.1(OPENSSL_1_1_0)(64bit) is needed by nodejs-1:10.13.0-2.el7.x86_64
    libuv >= 1:1.23.2 is needed by nodejs-1:10.13.0-2.el7.x86_64
    libuv.so.1()(64bit) is needed by nodejs-1:10.13.0-2.el7.x86_64
    npm = 1:6.4.1-1.10.13.0.2.el7 is needed by nodejs-1:10.13.0-2.el7.x86_64

感谢您为解决此警告和错误提供的任何帮助。提前致谢。

【问题讨论】:

    标签: node.js centos7 rpm


    【解决方案1】:

    你有两个选择:

    • 自己下载所有依赖项(很痛苦!),然后使用rpm -ivh *.rpm 安装所有依赖项
    • 使用像yumdnf 这样的包管理器来为您管理所有依赖项。如果您真的想安装您下载的确切版本,我建议您尝试简单地运行 yum install nodejs8 甚至 yum install ./nodejs-10.13.0-2.el7.x86_64.rpm

    【讨论】:

    • 感谢您的建议。我开始使用 yum 存储库来安装 nodejs 特定版本及其依赖项
    【解决方案2】:

    我使用 YUM 仓库来满足在 centos 7 中安装 nodejs 的依赖链。

    当我尝试使用 yum 命令安装时,不会自动下载所有依赖项,但仍然很少发生依赖项错误。

    yum install nodejs-10.13.0-2.el7.x86_64.rpm
    

    解决这个问题:

    • 在名为 (A) 的根目录中创建了一个目录。
    • 单独下载这几个依赖(你可以得到每个rpm文件 在谷歌搜索中)。
    • 将所有依赖项 rpm 文件与 nodejs rpm 一起放入
      目录 A。

    然后运行这个命令在A里面自动创建repodata目录。

    createrepo A
    

    在路径 /etc/yum.repos.d 中创建一个名为(local.repo) 的存储库文件

    [NodeUpgrade]
    name=Node Version Upgrade - NodeUpgrade
    baseurl=file:///A
    enabled=1
    gpgcheck=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 
    

    NodeUpgrade 是存储库名称。这个可以在执行命令的时候列出来

    yum repolist
    
    repo id           repo name                                   status
    NodeUpgrade       Node Version Upgrade - NodeUpgrade            7
    debuginfo         debuginfo                                    3160
    

    使用 yum 安装:

    sudo yum install nodejs
    

    列出可用的 nodejs 以查找已安装的 nodejs 并确保 repo 名称与 local.repo 中指定的名称匹配

    yum info nodejs
    
    Installed Packages
    Name        : nodejs
    Arch        : x86_64
    Epoch       : 1
    Version     : 10.13.0
    Release     : 2.el7
    Size        : 27 M
    Repo        : installed
    From repo   : NodeUpgrade
    Summary     : JavaScript runtime
    URL         : http://nodejs.org/
    License     : MIT and ASL 2.0 and ISC and BSD
    Description : Node.js is a platform built on Chrome's JavaScript
                : runtime for easily building fast, scalable network
                : applications. Node.js uses an event-driven,
                : non-blocking I/O model that makes it lightweight and
                : efficient, perfect for data-intensive real-time
                : applications that run across distributed devices.
    

    感谢您的建议@Chris Maes。我希望这个解释能带来清晰的画面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-10-14
      • 2015-05-21
      • 2023-03-04
      • 2019-07-01
      • 1970-01-01
      • 2019-05-16
      • 1970-01-01
      相关资源
      最近更新 更多