【问题标题】:Deepin 20 and updated NodejsDeepin 20 和更新的 Nodejs
【发布时间】:2021-02-15 06:20:14
【问题描述】:

有没有人可以在 Deepin 20 上获取当前节点/npm 版本的解决方案?

当尝试从 nodesource 安装时,我得到了这个:

支持确认“n/a”...

  • curl -sLf -o /dev/null 'https://deb.nodesource.com/node_14.x/dists/n/a/Release'

目前不支持您的发行版,标识为“n/a”, 请联系 NodeSource https://github.com/nodesource/distributions/issues 如果你这么认为 不正确或希望您的分发被考虑 支持

【问题讨论】:

    标签: node.js installation


    【解决方案1】:

    Deepin 未被列为 NodeSource 支持的发行版。

    作为一个 Debian 衍生产品,这样的东西应该可以工作:

    # Using Debian, as root
    curl -sL https://deb.nodesource.com/setup_14.x | bash -
    apt-get install -y nodejs
    

    否则你可以试试manual install。如果这样做,则需要指定 buster 代号,因为 Deepin 20 基于 Debian 10.5。

    【讨论】:

      【解决方案2】:

      这就是我安装 NodeJS 12 的方法。在终端中粘贴以下内容

      VERSION=node_12.x
      
      DISTRO="$(dpkg --status tzdata|grep Provides|cut -f2 -d'-')"
      
      echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list
      
      echo "deb-src https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
      
      sudo apt-get update
      
      sudo apt-get install nodejs
      

      这应该适用于 Deepin 20

      【讨论】:

        【解决方案3】:

        虽然Deepin 20.2可以直接从apt安装Node JS,但是版本太旧,不再维护了。

        另外,NodeJS的官方安装方式存在问题,不支持Deepin系统。

        所以你需要看一下这个脚本setup.14.x才能找到实际的安装方法。当然,如果你已经在Debian 或Ubuntu 上安装了它可能会更简单。

        在安装正式版之前,必须完全卸载深度操作系统自己的版本。

        sudo apt remove nodejs npm
        sudo apt autoremove
        

        添加以下内容

        /etc/apt/sources.list.d/nodesource.list:

        deb https://deb.nodesource.com/node_14.x buster main
        # deb-src https://deb.nodesource.com/node_14.x buster main
        

        然后添加官方密钥,就可以直接安装了。

        curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
        sudo apt update
        sudo apt install nodejs
        

        通过经验解决了问题。

        【讨论】:

        • 这应该被标记为答案。工作正常。
        • 效果很好!没问题!
        • 好人!非常感谢。
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2022-07-10
        • 2020-04-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-01-22
        相关资源
        最近更新 更多