LoginSignup
1
1

More than 3 years have passed since last update.

rails-erdがエラーで使えない! Graphvizが必要です

Posted at

環境

Vagrant + Ubuntu 16.04.5 LTS
Rails 5.2.4.2

はじめに

rails-erdとは、ER図のPDFファイルを自動作成してくれるgemです。Gemfilegem 'rails-erd'を記述して、bundle installすると、rails erdコマンドでPDFファイルが作成されるようなのだが、エラーが出てきたので、そのトラブルシューティングです。

手順

rails erdコマンドで、このようなエラーが出てきます。

$rails erd
rails aborted!
Unable to find GraphViz's "dot" executable. Please visit https://voormedia.github.io/rails-erd/install.html for installation instructions.
/vagrant/syougai/bin/rails:9:in `<top (required)>'
/vagrant/syougai/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => erd => erd:generate => erd:check_dependencies
(See full trace by running task with --trace)

どうも、Graphvizというツールをインストールしておかないといけないようです。Graphvizがインストールされていないのか念のために確認する。

$apt list --installed | grep grap
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

WARNINGが出てきたが、apt installはCLIでは利用してもいいが、スクリプト内で利用するには、apt-get installの方が推奨されていますという注意喚起のようです。

Graphvizをインストールする。

$sudo apt install graphviz

rails erdを実行する。

$rails erd

Railsのプロジェクトのルートに、erd.pdfが作成されました。

参考URL

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1