安装 node js 和 npm 时出现哈希和不匹配错误

安装 node js 和 npm 时出现哈希和不匹配错误
Err:37 http://archive.ubuntu.com/ubuntu focal/main DEP-11 64x64 Icons
  Hash Sum mismatch
  Hashes of expected file:
   - Filesize:162899 [weak]
   - SHA256:9f4ffba2a05dc2fb76857d4b30ed55724fe6e2999341694f2b86940ab067a44b
   - SHA1:f470f9b518e5cd213a66334f3a5e3b671c4dbe61 [weak]
   - MD5Sum:504d24e4682a64a0559d13f7cf1e5ca6 [weak]
  Hashes of received file:
   - SHA256:0d49809352ede8d21c648de700d0d16fe10c2394064b1bc457331e0565419e3a
   - SHA1:fd8bebb3573711be3d667718e13250cd7ae6b629 [weak]
   - MD5Sum:747cd4f065cae49a271e9b46cc88c6d6 [weak]
   - Filesize:162899 [weak]
  Last modification reported: Mon, 20 Apr 2020 09:35:48 +0000
  Release file created at: Thu, 23 Apr 2020 17:33:17 +0000

.
.
.
.
.
.
.

 E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/main/dep11/by-hash/SHA256/9f4ffba2a05dc2fb76857d4b30ed55724fe6e2999341694f2b86940ab067a44b  Hash Sum mismatch
       Hashes of expected file:
        - Filesize:162899 [weak]
        - SHA256:9f4ffba2a05dc2fb76857d4b30ed55724fe6e2999341694f2b86940ab067a44b
        - SHA1:f470f9b518e5cd213a66334f3a5e3b671c4dbe61 [weak]
        - MD5Sum:504d24e4682a64a0559d13f7cf1e5ca6 [weak]
       Hashes of received file:
        - SHA256:0d49809352ede8d21c648de700d0d16fe10c2394064b1bc457331e0565419e3a
        - SHA1:fd8bebb3573711be3d667718e13250cd7ae6b629 [weak]
        - MD5Sum:747cd4f065cae49a271e9b46cc88c6d6 [weak]
        - Filesize:162899 [weak]
       Last modification reported: Mon, 20 Apr 2020 09:35:48 +0000
       Release file created at: Thu, 23 Apr 2020 17:33:17 +0000
    E: Some index files failed to download. They have been ignored, or old ones used instead.

我尝试了其他答案中提供的所有可能的解决方案,但问题仍然存在。我正在使用 ubuntu 20.04。我是 Linux 环境的新手,所以我对 Linux 系统和术语不太了解。

我尝试安装 node js 和 npm。使用 apt-get 时遇到很多问题。

问题:

  1. 使用 apt-get 安装后未找到 npm 命令

    Command 'npm' not found, did you mean:
    
      command 'apm' from snap atom (1.48.0)
      command 'nsm' from snap nift (2.3.10)
    
    See 'snap info <snapname>' for additional versions.
    
  2. 当我尝试安装时sudo apt-get install python-software-properties

    我有,

     Reading package lists... Done
        Building dependency tree       
        Reading state information... Done
        Some packages could not be installed. This may mean that you have
        requested an impossible situation or if you are using the unstable
        distribution that some required packages have not yet been created
        or been moved out of Incoming.
        The following information may help to resolve the situation:
    
        The following packages have unmet dependencies:
         python-software-properties : Depends: python (>= 2.7) but it is not going to be installed
                                      Depends: python (< 2.8) but it is not going to be installed
                                      Depends: python-apt (>= 0.6.20ubuntu16) but it is not going to be installed
                                      Depends: python-pycurl but it is not going to be installed
        E: Unable to correct problems, you have held broken packages.
    
  3. 当我尝试使用以下方法单独安装 npm 时apt-get npm

       The following packages have unmet dependencies:
         npm : Depends: node-gyp (>= 0.10.9) but it is not going to be installed
        E: Unable to correct problems, you have held broken packages.
    

答案1

我找到了问题所在...是我的互联网连接...当我连接到我的移动数据(或任何其他互联网服务)时...它是完美无缺的......

如果尝试多种解决方案后哈希总和错误仍然存​​在,请尝试更改您的互联网连接。我相信它应用了一些会改变哈希的网络过滤器。

相关内容