问题
When I run rake db:migrate
I get this error
rake aborted!
Saving diagram failed!
Verify that Graphviz is installed and in your path, or use filetype=dot.
Full log:
rake db:migrate
Loading application environment...
Loading code in search of Active Record models...
Generating Entity-Relationship Diagram for 20 models...
rake aborted!
Saving diagram failed!
Verify that Graphviz is installed and in your path, or use filetype=dot.
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram/graphviz.rb:207:in `rescue in block in <class:Graphviz>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram/graphviz.rb:198:in `block in <class:Graphviz>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:142:in `instance_eval'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:142:in `save'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:120:in `create'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:74:in `create'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/tasks.rake:41:in `block (2 levels) in <top (required)>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/tasks/auto_generate_diagram.rake:18:in `update_model'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/tasks/auto_generate_diagram.rake:3:in `block (2 levels) in <top (required)>'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
StandardError: GraphViz not installed or dot not in PATH. Install GraphViz or use the 'path' option
/home/bcc/.rvm/gems/ruby-2.2.3/gems/ruby-graphviz-1.2.2/lib/graphviz.rb:544:in `output'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram/graphviz.rb:200:in `block in <class:Graphviz>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:142:in `instance_eval'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:142:in `save'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:120:in `create'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:74:in `create'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/tasks.rake:41:in `block (2 levels) in <top (required)>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/tasks/auto_generate_diagram.rake:18:in `update_model'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/tasks/auto_generate_diagram.rake:3:in `block (2 levels) in <top (required)>'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => erd => erd:generate
(See full trace by running task with --trace)
bcc@bcc /media/bcc/Other/work/incomingerasmus $ git branch
master
* rails4
bcc@bcc /media/bcc/Other/work/incomingerasmus $ rake db:migrate
Loading application environment...
Loading code in search of Active Record models...
Generating Entity-Relationship Diagram for 20 models...
rake aborted!
Saving diagram failed!
Verify that Graphviz is installed and in your path, or use filetype=dot.
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram/graphviz.rb:207:in `rescue in block in <class:Graphviz>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram/graphviz.rb:198:in `block in <class:Graphviz>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:142:in `instance_eval'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:142:in `save'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:120:in `create'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:74:in `create'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/tasks.rake:41:in `block (2 levels) in <top (required)>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/tasks/auto_generate_diagram.rake:18:in `update_model'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/tasks/auto_generate_diagram.rake:3:in `block (2 levels) in <top (required)>'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
StandardError: GraphViz not installed or dot not in PATH. Install GraphViz or use the 'path' option
/home/bcc/.rvm/gems/ruby-2.2.3/gems/ruby-graphviz-1.2.2/lib/graphviz.rb:544:in `output'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram/graphviz.rb:200:in `block in <class:Graphviz>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:142:in `instance_eval'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:142:in `save'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:120:in `create'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:74:in `create'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/tasks.rake:41:in `block (2 levels) in <top (required)>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/tasks/auto_generate_diagram.rake:18:in `update_model'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/tasks/auto_generate_diagram.rake:3:in `block (2 levels) in <top (required)>'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => erd => erd:generate
(See full trace by running task with --trace)
If I run the command with --trace I get this
rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:schema:dump
** Invoke erd (first_time)
** Invoke erd:generate (first_time)
** Invoke erd:options (first_time)
** Execute erd:options
** Invoke erd:load_models (first_time)
** Execute erd:load_models
Loading application environment...
** Invoke environment
Loading code in search of Active Record models...
** Execute erd:generate
Generating Entity-Relationship Diagram for 20 models...
rake aborted!
Saving diagram failed!
Verify that Graphviz is installed and in your path, or use filetype=dot.
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram/graphviz.rb:207:in `rescue in block in <class:Graphviz>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram/graphviz.rb:198:in `block in <class:Graphviz>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:142:in `instance_eval'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:142:in `save'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:120:in `create'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:74:in `create'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/tasks.rake:41:in `block (2 levels) in <top (required)>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/bcc/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:201:in `block in invoke_prerequisites'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:199:in `each'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:199:in `invoke_prerequisites'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:178:in `block in invoke_with_call_chain'
/home/bcc/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/tasks/auto_generate_diagram.rake:18:in `update_model'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/tasks/auto_generate_diagram.rake:3:in `block (2 levels) in <top (required)>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/bcc/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/rake:23:in `load'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/rake:23:in `<main>'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
StandardError: GraphViz not installed or dot not in PATH. Install GraphViz or use the 'path' option
/home/bcc/.rvm/gems/ruby-2.2.3/gems/ruby-graphviz-1.2.2/lib/graphviz.rb:544:in `output'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram/graphviz.rb:200:in `block in <class:Graphviz>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:142:in `instance_eval'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:142:in `save'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:120:in `create'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/diagram.rb:74:in `create'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/rails_erd/tasks.rake:41:in `block (2 levels) in <top (required)>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/bcc/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:201:in `block in invoke_prerequisites'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:199:in `each'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:199:in `invoke_prerequisites'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:178:in `block in invoke_with_call_chain'
/home/bcc/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/tasks/auto_generate_diagram.rake:18:in `update_model'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rails-erd-1.4.5/lib/tasks/auto_generate_diagram.rake:3:in `block (2 levels) in <top (required)>'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/bcc/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/home/bcc/.rvm/gems/ruby-2.2.3/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/rake:23:in `load'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/rake:23:in `<main>'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
/home/bcc/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => erd => erd:generate
I don't understand the problem. I am facing this problem after I upgraded my application from rails 3 to rails 4.2. My application is running without any problem. But when I run rake db:migrate command
I get this error. How to solve this problem?
There is a line in the error log might be important but I don't understand it.
GraphViz not installed or dot not in PATH. Install GraphViz or use the 'path' option
回答1:
It's because your project is using Rails ERD, a gem that can automatically create ERDs - entity relationship diagrams. It relies on a library called graphviz
to run. If you want to continue to use it, you'll have to install graphviz
. On Linux you can do this via console:
sudo apt-get install graphviz
If you don't want to use the rails-erd
gem, remove it from your Gemfile and bundle
. If you don't see it in your Gemfile, look at your Gemfile.lock to determine what is requiring the rails-erd
gem and think about removing that gem.
回答2:
Try with below commands.
erd --inheritance --direct --attributes=foreign_keys,content --filetype=dot
dot -Tjpg erd.dot > erd.jpg
来源:https://stackoverflow.com/questions/35038840/saving-diagram-failed-verify-that-graphviz-is-installed-and-in-your-path-or-us