AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 541939
Accepted
mike rodent
mike rodent
Asked: 2019-09-16 16:28:19 +0800 CST2019-09-16 16:28:19 +0800 CST 2019-09-16 16:28:19 +0800 CST

我尝试在 Linux 中安装/升级 Node.JS 出了什么问题?

  • 772

操作系统:Linux Mint 18.3。类似于 Ubuntu。

与 Linux 一样,我真的不知道我打算如何安装软件:

  1. 它已经在系统上了吗?在这种情况下是的,但它很旧:4.2.6。在撰写本文时,当前的 LTS 版本是 10.16.3。
  2. 我应该使用apt吗?
  3. 我应该使用软件管理器吗?
  4. 我应该使用 PPA 吗?
  5. 我应该下载压缩文件并解压缩吗?

来自其他用户的软件管理器评论类似于“去这里获取最新版本”(https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions)

第一个命令是

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

这失败了:

> 
mike@M17A ~ $  curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
[sudo] password for mike: 

## Installing the NodeSource Node.js 10.x repo...


## Populating apt-get cache...

+ apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease                        
Hit:3 http://dl.google.com/linux/chrome/deb stable Release                     
Hit:4 http://ppa.launchpad.net/adabbas/1stppa/ubuntu xenial InRelease          
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]       
Get:6 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]     

... // then many messages like this:

Ign:42 https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu serena/main all Packages
Ign:43 https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu serena/main Translation-en_GB
Ign:44 https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu serena/main Translation-en_GB
Ign:44 https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu serena/main Translation-en
Fetched 329 kB in 23s (14.0 kB/s)
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://repository.spotify.com stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4773BD5E130D1D45
W: The repository 'https://mirrors.evowise.com/mariadb/repo/10.1/ubuntu serena Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu serena Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: Failed to fetch http://repository.spotify.com/dists/stable/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4773BD5E130D1D45
E: Failed to fetch https://mirrors.evowise.com/mariadb/repo/10.1/ubuntu/dists/serena/main/binary-amd64/Packages  404  Not Found
E: Failed to fetch https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu/dists/serena/main/binary-amd64/Packages  404  Not Found
W: Some index files failed to download. They have been ignored, or old ones used instead.
Error executing command, exiting

...我不确定所有这些 mariadb 命令的全部内容。我的系统上有 MariaDB,我担心有什么问题。

NB 尝试下一个命令似乎表明这已经失败:

mike@M17A ~ $  sudo apt-get install -y nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nodejs is already the newest version (4.2.6~dfsg-1ubuntu4.2).
0 to upgrade, 0 to newly install, 0 to remove and 600 not to upgrade.

... 即系统仍然认为 4.2.6 是最新版本。

更一般地说,在 Linux 中安装新软件的协议究竟是什么:上面的编号列表(从 1 到 5)是正确的方法吗?专家安装新软件的方法的优先顺序是什么?

然后我尝试了什么

似乎失败sudo apt-get update是问题的根源。

受其他问题的启发,我尝试了这个:

sudo rm /var/lib/apt/lists/* -vf

其次是:

sudo apt-get update

更多对我来说意义不大的错误和警告列表:

...
Err:40 https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu serena/main amd64 Packages
  404  Not Found
Ign:41 https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu serena/main i386 Packages
Ign:42 https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu serena/main all Packages
Ign:43 https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu serena/main Translation-en_GB
Ign:44 https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu serena/main Translation-en
Fetched 329 kB in 28s (11.6 kB/s)
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://repository.spotify.com stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4773BD5E130D1D45
W: The repository 'https://mirrors.evowise.com/mariadb/repo/10.1/ubuntu serena Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu serena Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: Failed to fetch http://repository.spotify.com/dists/stable/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4773BD5E130D1D45
E: Failed to fetch https://mirrors.evowise.com/mariadb/repo/10.1/ubuntu/dists/serena/main/binary-amd64/Packages  404  Not Found
E: Failed to fetch https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu/dists/serena/main/binary-amd64/Packages  404  Not Found
W: Some index files failed to download. They have been ignored, or old ones used instead.

后来我在github页面尝试了“手动安装”...... 以同样的方式失败:

mike@M17A ~ $  VERSION=node_10.16.3
mike@M17A ~ $  DISTRO="$(lsb_release -s -c)"
mike@M17A ~ $  echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list
deb https://deb.nodesource.com/node_10.16.3 sylvia main
mike@M17A ~ $  echo "deb-src https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
deb-src https://deb.nodesource.com/node_10.16.3 sylvia main
mike@M17A ~ $  sudo apt-get update
Hit:1 http://ppa.launchpad.net/adabbas/1stppa/ubuntu xenial InRelease
...

Ign:57 https://deb.opera.com/opera-stable stable/non-free Translation-en
Err:58 https://deb.opera.com/opera-stable stable/non-free amd64 Packages
  503  Backend unavailable, connection timeout
Ign:59 https://deb.opera.com/opera-stable stable/non-free i386 Packages
Fetched 3,316 B in 34s (95 B/s)
Reading package lists... Done
W: The repository 'https://deb.nodesource.com/node_10.x sylvia Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://repository.spotify.com stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4773BD5E130D1D45
W: The repository 'http://repository.spotify.com stable InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'https://mirrors.evowise.com/mariadb/repo/10.1/ubuntu serena Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu serena Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'https://deb.opera.com/opera-stable stable Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch https://deb.nodesource.com/node_10.x/dists/sylvia/main/binary-amd64/Packages  404  Not Found
E: Failed to fetch https://mirrors.evowise.com/mariadb/repo/10.1/ubuntu/dists/serena/main/binary-amd64/Packages  404  Not Found
E: Failed to fetch https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu/dists/serena/main/binary-amd64/Packages  404  Not Found
E: Failed to fetch https://deb.opera.com/opera-stable/dists/stable/non-free/binary-amd64/Packages  503  Backend unavailable, connection timeout
E: Some index files failed to download. They have been ignored, or old ones used instead.
linux-mint
  • 2 2 个回答
  • 7935 Views

2 个回答

  • Voted
  1. John Smith
    2021-08-25T14:21:18+08:002021-08-25T14:21:18+08:00

    当您node.js使用安装时,sudo apt install nodejs您将获得一个版本,该版本经过测试在您的 Linux 发行版中是稳定的。这也意味着您会得到一个非常过时的软件版本,并且某些软件包会拒绝使用它。比如当前版本的Rocket.Chatrequires node.js >= 12,而我Ubuntu 20.04的官方版本是 10.x 之类的。在您编写问题时,它可能很新,这就是您使用命令的原因

    curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
    

    它执行一个脚本,安装版本node.js-10.x。

    据我所知,脚本抱怨的问题是它无法找到它正在使用的某些存储库的公钥。密钥的问题通常是由于root用户的一些奇怪设置,密钥文件的权限被证明是错误的。

    解决方案是检查目录中的权限

    $ ls -l /etc/apt/sources.list.d/
    $ ls -l /usr/share/keyrings/
    

    他们应该看起来像这样(-rw-r--r--是许可644)

    -rw-r--r-- 1 root root  2206 Aug 25 00:40 nodesource.gpg
    

    如果某些文件的输出不同,请手动更改

    sudo chmod 644 /usr/share/keyrings/nodesource.gpg
    
    • 3
  2. Best Answer
    mike rodent
    2019-09-17T15:43:28+08:002019-09-17T15:43:28+08:00

    我做到了。最后我发现我不得不调整一个安装脚本。

    具体来说这是从这里来的。但是,我没有执行 CURL 命令,而是从该 URL 下载了脚本,并用“apt-get update”注释掉了这两行……然后命名该文件并使其可执行并运行它。

    然后我去了

    sudo apt-get update
    

    然后我去了

    sudo apt-get install nodejs
    

    原因apt-get update是当前在我的系统上返回错误,并且似乎在脚本在源列表中设置 PPA 之前杀死了脚本(这是正确的术语吗?)。我可能错了。我是一个低级的 Linux 人。

    注意一个脚本似乎是必要的,尤其是我注意到有一个部分文件“翻译”了从我的系统中找到的“Linux Mint”-“sylvia”到“Ubuntu”-“xenial”。实际上,在下载站点,URL“.../Linux Mint/sylvia/...”是不存在的,并返回 404。

    • 0

相关问题

  • 在 Linux Mint 上更新 libinput

  • linux java -version 仅适用于 root 用户[关闭]

  • 在 Linux Mint 上用 LightDM 替换 MDM 的正确程序是什么?

  • Linux Mint 内核损坏

  • Synaptic 包管理器文件设置

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve