4

So I was following along this video https://www.youtube.com/watch?v=bDjbqRL9HcM i came to a part where I should use the rake task then this happened:

blog$ rake neo4j:install[community-2.1.5] --trace

rake aborted!

Don't know how to build task 'neo4j:install'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/task_manager.rb:62:in `[]'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:149:in `invoke_task'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:106:in `each'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/home/james/.rvm/gems/ruby-2.1.3/bin/rake:23:in `load'
/home/james/.rvm/gems/ruby-2.1.3/bin/rake:23:in `<main>'
/home/james/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `eval'
/home/james/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `<main>'

I tried this on Ubuntu 14.04. I have installed rvm.io. Any suggestion to how I can fix this?

  • That is odd. Did you start with a new rails app? If so, did you run the full setup command for starting with neo4j? `rails new myapp -m http://neo4jrb.github.com/neo4j/neo4j.rb -O` I just did that and it seems to work – Brian Underwood Oct 21 '14 at 14:36
  • Yes I tried to exactly do what you did in your youtube clip. I dont know if it has something to do with rvm.io. – James Ramsfield Oct 21 '14 at 17:06

2 Answers2

0

I tried to put the following into the RakeFile, that was created when I ran rails new: require 'neo4j/tasks/neo4j_server' - it seems to work by giving the following output:

/blog$ rake neo4j:install[community-2.1.5] Installing Neo4j-community-2.1.5 environment: development Neo4j Installed in to neo4j directory

I added the following to application.rb: require 'neo4j/railtie' - I can now use rails generate scaffold User name:string email:string

I have no clue, why it works. Maybe you can give a good explanation?

  • That's really puzzling. We've actually had problems because in older versions of the gem you needed the require in your Rakefile but we removed the need for that and some people were writing in because they needed to remove that line. I can imagine the `require 'neo4j/railtie'` would help because that's part of what brings in the rake tasks, but I think you'll need to remove the Rakefile line for that to keep working now. Not sure why the rail app generation didn't add `require 'neo4j/railtie'` to your application.rb though... – Brian Underwood Oct 22 '14 at 06:59
  • what does -m and -0 do in rails new myapp -m `http://neo4jrb.github.com/neo4j/neo4j.rb -O` ? – James Ramsfield Oct 22 '14 at 07:52
  • I believe the `-m` is for specifying a script to run (in this case a script we host on github). The `-O` is to install without activerecord – Brian Underwood Oct 22 '14 at 07:59
  • it will work fine by not using -0 - I want to connect to both postgres and a the neo4j server? – James Ramsfield Oct 22 '14 at 09:18
  • Good to know! Probably we should update our docs and the video to reflect this possibility since a lot of people want to do it – Brian Underwood Oct 22 '14 at 09:27
  • Sorry, I think you misunderstood. I'm asking if it is possible to use this command without `-0`? I will try it when I come home. Sorry for my bad writing. Anyway, If I run `rake --task` I can't see neo4j anywhere, so using without `-0` would probably not be much help. I will keep digging! – James Ramsfield Oct 22 '14 at 10:43
  • FYI it's `-O`, not `-0` I think. And I'm not sure if it would work, but let me know if it does! It's definitely possible to run both, the only question is getting the right `application.rb` configuration. Also try taking the `require` out of the rake file and make sure the `require 'neo4j/railtie'` is in your `application.rb` – Brian Underwood Oct 22 '14 at 11:35
0

If you want to have all the neo4j rake tasks included in your project add this code to your Rakefile:

require 'neo4j/rake_tasks'

This is because the gem neo4j-rake_tasks is automatically added with the neo4j gem but you still need to include it in your Rakefile.

after that do: rake -T you should see:

rake neo4j:change_password                   # Neo4j 2.2: Change connection password
rake neo4j:config[environment,port]          # Configure Server, e.g
rake neo4j:disable_auth[environment]         # Neo4j 2.2: Disable Auth
rake neo4j:enable_auth[environment]          # Neo4j 2.2: Enable Auth
rake neo4j:info[environment]                 # Get info the Neo4j Server
rake neo4j:install[edition,environment]      # Install Neo4j with auth disabled in v2.2+
rake neo4j:migrate[task_name,subtask]        # Run a script against the database to perform system-wide changes
rake neo4j:reset_yes_i_am_sure[environment]  # Reset the Neo4j Server
rake neo4j:restart[environment]              # Restart the Neo4j Server
rake neo4j:start[environment]                # Start the Neo4j Server
rake neo4j:start_no_wait[environment]        # Start the Neo4j Server asynchronously
rake neo4j:stop[environment]                 # Stop the Neo4j Server
rolele
  • 781
  • 9
  • 24