Ubuntu中使用 apt-get install 安装软件出现“E: Package *** has no installation candidate” 错误的解决方案

在laravel环境部署过程中,laravel默认集成了一些 NPM 扩展包,用到

yarn install --no-bin-links

来安装扩展包,但一直报错,最后发现需要执行

sudo apt-get install libpng16-dev

来安装 libpng16-dev包,在安装libpng16-dev包的时候又开始报错

E: Package 'libpng16-dev' has no installation candidate

百度发现是由于缺少某些包,执行

sudo apt-get update

又开始报错无法升级,解决这个问题需要步骤如下

/etc/apt/sources.list,打开源列表文件,把如下内容粘贴到最下面,最好提前备份一下sources.list文件.

deb http://old-releases.ubuntu.com/ubuntu lucid main restricted universe multiverse   
deb http://old-releases.ubuntu.com/ubuntu lucid-security main restricted universe multiverse   
deb http://old-releases.ubuntu.com/ubuntu lucid-updates main restricted universe multiverse   
deb http://old-releases.ubuntu.com/ubuntu lucid-proposed main restricted universe multiverse   
deb http://old-releases.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse   
deb-src http://old-releases.ubuntu.com/ubuntu lucid main restricted universe multiverse   
deb-src http://old-releases.ubuntu.com/ubuntu lucid-security main restricted universe multiverse   
deb-src http://old-releases.ubuntu.com/ubuntu lucid-updates main restricted universe multiverse   
deb-src http://old-releases.ubuntu.com/ubuntu lucid-proposed main restricted universe multiverse   
deb-src http://old-releases.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse 

然后 sudo apt-get update,sudo apt-get upgrade,再执行

sudo apt-get install libpng16-dev

然后执行

yarn install --no-bin-links

成功解决了我的问题!

注:如部分朋友依然有报错信息需要在执行完sudo apt-get update,sudo apt-get upgrade后再执行一下

sudo apt-get -f install
来修复受损软件包!








你可能感兴趣的:(Ubuntu中使用 apt-get install 安装软件出现“E: Package *** has no installation candidate” 错误的解决方案)