E:在源列表 /etc/apt/sources.list.d/yarn.list 的第 1 行中类型“许可证”未知 E:无法读取源列表

E:在源列表 /etc/apt/sources.list.d/yarn.list 的第 1 行中类型“许可证”未知 E:无法读取源列表

当我跑步时

sudo apt-get update

我收到此错误:

E: Type 'License' is not known on line 1 in source list /etc/apt/sources.list.d/yarn.list
E: The list of sources could not be read.

我尝试进入该位置并删除第 1 行。然后我重新运行该命令。

结果

下一行显示相同的错误,并且仍然如此!我必须删除所有行吗?我该怎么办?

编辑

当我运行此命令时

cat /etc/apt/sources.list.d/yarn.list

输出

deb http://archive.ubuntu.com/ubuntu precise main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu precise universe main multiverse restricted

deb http://security.ubuntu.com/ubuntu/ precise-security universe main multiverse restricted
deb http://archive.ubuntu.com/ubuntu precise-updates universe main multiverse restricted
deb http://archive.ubuntu.com/ubuntu precise-backports universe main multiverse restricted

# deb http://archive.canonical.com/ubuntu precise partner
# deb-src http://archive.canonical.com/ubuntu precise partner

# deb http://extras.ubuntu.com/ubuntu precise main
# deb-src http://extras.ubuntu.com/ubuntu precise main

License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html> This is free software: you are free
to change and redistribute it. There is NO WARRANTY, to the extent
permitted by law.

Home: /tmp/apt-key-gpghome.UZ7VSJpZcy
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

Syntax: gpg [options] [files]
Sign, check, encrypt or decrypt
Default operation depends on the input data

Commands:
 
 -s, --sign                  make a signature
     --clear-sign            make a clear text signature
 -b, --detach-sign           make a detached signature
 -e, --encrypt               encrypt data
 -c, --symmetric             encryption only with symmetric cipher
 -d, --decrypt               decrypt data (default)
     --verify                verify a signature
 -k, --list-keys             list keys
     --list-signatures       list keys and signatures
     --check-signatures      list and check key signatures
     --fingerprint           list keys and fingerprints
 -K, --list-secret-keys      list secret keys
     --generate-key          generate a new key pair
     --quick-generate-key    quickly generate a new key pair
     --quick-add-uid         quickly add a new user-id
     --quick-revoke-uid      quickly revoke a user-id
     --quick-set-expire      quickly set a new expiration date
     --full-generate-key     full featured key pair generation
     --generate-revocation   generate a revocation certificate
     --delete-keys           remove keys from the public keyring
     --delete-secret-keys    remove keys from the secret keyring
     --quick-sign-key        quickly sign a key
     --quick-lsign-key       quickly sign a key locally
     --sign-key              sign a key
     --lsign-key             sign a key locally
     --edit-key              sign or edit a key
     --change-passphrase     change a passphrase
     --export                export keys
     --send-keys             export keys to a keyserver
     --receive-keys          import keys from a keyserver
     --search-keys           search for keys on a keyserver
     --refresh-keys          update all keys from a keyserver
     --import                import/merge keys
     --card-status           print the card status
     --edit-card             change data on a card
     --change-pin            change a card's PIN
     --update-trustdb        update the trust database
     --print-md              print message digests
     --server                run in server mode
     --tofu-policy VALUE     set the TOFU policy for a key

Options:
 
 -a, --armor                 create ascii armored output
 -r, --recipient USER-ID     encrypt for USER-ID
 -u, --local-user USER-ID    use USER-ID to sign or decrypt
 -z N                        set compress level to N (0 disables)
     --textmode              use canonical text mode
 -o, --output FILE           write output to FILE
 -v, --verbose               verbose
 -n, --dry-run               do not make any changes
 -i, --interactive           prompt before overwriting
     --openpgp               use strict OpenPGP behavior

(See the man page for a complete listing of all commands and options)

Examples:

 -se -r Bob [file]          sign and encrypt for user Bob
 --clear-sign [file]        make a clear text signature
 --detach-sign [file]       make a detached signature
 --list-keys [names]        show keys
 --fingerprint [names]      show fingerprints

Please report bugs to <https://bugs.gnupg.org>.
OK

答案1

美好的sudo rm /etc/apt/sources.list.d/yarn.list

比较你的/etc/apt/sources.list 和我的

deb http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse

deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

尝试sudo apt update。如果 apt 抱怨其他错误,请删除文件夹下的文件/etc/apt/sources.list.d/

相关内容