heroku error W: Not using locking for read only lock file /var/lib/dpkg/lock-frontend

目的: Heroku環境で Laravel でimagemagickを利用したいと思った

原因: herokuはsudoの制限が数多くかけられている

多くのパケージがインストールできない。

参考資料

unix.stackexchange.com

エラーの例

imagemagick is already the newest version (8:6.9.7.4+dfsg-16ubuntu6.8).
W: Not using locking for read only lock file /var/lib/dpkg/lock-frontend
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: Archives directory /var/cache/apt/archives/partial is missing.

buidl packという方法が備えられている

公式サイト

devcenter.heroku.com

1.ターミナルからherokuのコマンドを叩く

imagemagickのビルドパックを作っている人がいた

urlをheroku buildpacks:add すれば良い

f:id:happy_teeth_ago:20200824100408j:plain

$ heroku buildpacks:add  https://github.com/heroku/heroku-buildpack-apt

2.Aptfileをプロジェクトフォルダに追加

rootに追加する

imagemagickとだけ記載する

imagemagick

3.デプロイする

git push heroku master

参考にさせていただきました。 https://qiita.com/haru1843/items/210cb08024195b9d1bc8