Ubuntu apt-get NO_PUBKEY solution

Ubuntu

Scenario

1
2
3
4
5
# when run apt-get update or apt-get install you got below error

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E074D16EB6FF4DE3
W: Failed to fetch https://dl.yarnpkg.com/debian/dists/stable/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E074D16EB6FF4DE3
W: Some index files failed to download. They have been ignored, or old ones used instead.

Solution

1
2
3
4
# Add the latest key that will be fixed
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
# or
wget -qO - https://raw.githubusercontent.com/yarnpkg/releases/gh-pages/debian/pubkey.gpg | sudo apt-key add -

Reference

https://github.com/yarnpkg/yarn/issues/4453