【问题标题】:Getting python2 error in nodejs installation in Ubuntu 20.04在 Ubuntu 20.04 上安装节点 js 时出现 python2 错误
【发布时间】:2020-08-31 00:18:36
【问题描述】:

我已更新到新的 Ubuntu 20.04LTS 版本,并且我的所有节点安装都已删除。所以安装节点我尝试了以下两种方法:

1.sudo apt 更新

sudo apt install nodejs npm

  1. 卷曲-sLhttps://deb.nodesource.com/setup_12.x | sudo -E bash -

sudo apt install nodejs

安装 nodejs 时出现错误: nodejs : Depends: python2-minimal 但它不可安装。无法纠正问题,您持有破损的包裹。

screenshot

【问题讨论】:

    标签: node.js ubuntu npm ubuntu-20.04


    【解决方案1】:

    你需要安装python2。 Ubuntu 20 中的步骤

    1. sudo add-apt-repository universe
    2. sudo apt-get update
    3. sudo apt-get install python2 这将成功安装 python2。现在您可以继续正常的 nodejs 安装

    【讨论】:

      【解决方案2】:

      我遇到了类似的问题,按照https://speedysense.com/install-nodejs-on-ubuntu-20-04/上的说明解决了

      Tldr 在终端上运行这些:对于当前的 LTS 版本 (v14.x),

      curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
      
      sudo apt-get install -y nodejs
      

      然后通过在终端上运行这些来检查您的 Nodejs 和 npm 版本:

      node --version
      npm --version
      

      【讨论】:

        猜你喜欢
        • 2021-04-07
        • 2020-11-08
        • 2022-11-28
        • 2021-05-17
        • 2021-04-11
        • 1970-01-01
        • 2022-01-23
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多