Getting error neo4j [not found] when trying to generate a model - ruby-on-rails-3

I installed JRuby and the neo4j gem and trying to use a generator to create a model:
jruby -S rails generate scaffold User name:string born:date --orm=neo4j
However, I get this error:
error neo4j [not found]
I tried installing neo4j through bundler and just gem install. Either way, which neo4j returns nothing.
I tried this with the the neo4j-rails gem as well but I the neo4j rubyforge page says it is no longer needed. I also tried just generating a model rather than a scaffold.
Is this error specific to just generators or does it mean that my neo4j installation didn't work?

Your installation did not work.
The problem is that you have probably installed version 0.4.6 which is not specific to the JRuby platform but also installs (incorrectly) on MRI. So the error 'neo4j [not found]' is because you are using JRuby and installed the neo4j.rb gem in MRI. Neo4j.rb version >= 1.0.0 can only be installed on JRuby.
I recommend using RVM:
rvm install jruby
rvm use jruby
gem install bundler
bundle install

Related

JRuby failing to install gem dependency cool.io

I'm new with ruby and I'm facing a problem with installing some gems required by a ruby project I'm trying to build
I have installed rvm and I try to run the following command to fetch, if I understand well the missing dependencies of my project
$> jruby --1.9 /home/user/.gem/jruby/1.9/bin/bundle install
And I fall into the following exception:
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Installing rake 0.9.6
Installing addressable 2.3.6
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/jruby-1.7.12-dev/bin/jruby extconf.rb
/usr/local/rvm/rubies/jruby-1.7.12/lib/ruby/shared/mkmf.rb:14: Use RbConfig instead of obsolete and deprecated Config.
mkmf.rb can't find header files for ruby at /usr/local/rvm/rubies/jruby-1.7.12/lib/native/include/ruby/ruby.h
extconf failed, uncaught signal 1
Gem files will remain installed in /usr/local/rvm/gems/jruby-1.7.12/gems/cool.io-1.2.4 for inspection.
Results logged to /usr/local/rvm/gems/jruby-1.7.12/extensions/universal-java-1.7/1.9/cool.io-1.2.4/gem_make.out
My version is
$> ruby -v
jruby 1.7.12 (1.9.3p392) 2014-04-15 643e292 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_60-b19 [linux-amd64]
I've seen on similar posts that a dev package is missing but how do I install it via rvm?
JRuby's native extension support was an experiment and is not recommended to be used.
All of your gems that use MRI's native extension API might just no longer work on JRuby, usually mature gems provide a JRuby specific alternative but that is not always the case.
cool.io gem seems to be one of those (will only work on MRI as it needs to build it's native extension)

Getting Rails working with a JS runtime environment

I'm using Ubuntu 11.10 and the terminal to install and run Rails. Here
is the process I've taken so far to setup Rails:
download and install Ruby 1.9.2 and Rails 3.1.0
-- I did this using sudo apt-get ruby1.9.1 and sudo gem install
rails
I made a new rails app using rails new path/to/app
I went to the new app directory and tried running rails server and got an
error about not having a JS ruby environment
I had to get a JS runtime environment for execjs so I downloaded 'therubyracer'
as well as 'therubyrhino' and added them to my gem file, one at a time like this:
gem
'therubyracer' then ran bundle install
After everything was successful with the install, I ran rails server again
-- with both runtime environments I have had similar errors:
Could not find libv8-3.3.10.4 in any of the sources
Run `bundle install` to install missing gems.
Could not find therubyrhino-1.73.0 in any of the sources
Run `bundle install` to install missing gems.
Bundle knows where these programs live, giving correct pathnames when I
enter bundle show libv8 or bundle show therubyrhino. They are both
in /usr/lib/ruby/gems/1.9.1/gems/_ where all the other gems are
located for the bundle install.
Does anyone know where this exception is coming up in the Rails source
code? Does anyone know how Rails is gathering the gems? Better yet,
anyone had this problem and know how to fix it?
Thanks so much,
Feav
Have you tried starting the server using bundle exec rails server?
This problem has been fixed in a newer version of Rails.

Project folders and gems for Rails 3

I am new to Rails and have been trying to setup up my Mac to handle some development. I am currently in a project folder and trying to install a Gem and get this error:
*bash-3.2$ gem install pg
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.*
It appears its trying to install this to the 1.8 directory. I would like all gems to be installed only for this project and not for everything.
Here is my folder structure for Rails projects.
Rails Projects:
Project 1:
Project 2:
How do I correct the issue with the gem installation so it only goes into a specific folder. This goes for the ruby version as well.
Thanks for the help.
You need to be using RVM, the Ruby Version Manager, found at http://beginrescueend.com/
I assume you already have installed XCode and Macports (or something like it).
Install rails using "gem install rails"
Use "rails new new-project" to setup your new rails project
Use bundler to add any new gems to your project http://gembundler.com/
Finally, if you want to use MySQL, there is a trick to getting the mysql2 gem configured properly on Mac. That is covered in this stackoverflow post.
Without installing RVM, which you should be doing anyway, you just need to use sudo to install the gems. By default, your user account does not have write permissions to the default gem installation directory.
sudo gem install pg

Mac OS X Leopard showing different version of Rails after install

so I'm installing rails with
gem install rails
and I didn't have any version of rails prior to the one I'm installing (3.0.9).
By the time the installation finishes I get the documentation error
Installing ri documentation for rails-3.0.9...
file 'lib' not found
Installing RDoc documentation for rails-3.0.9...
Even though it says that rails 3.0.9 was installed successfully.
If I run
gem list rails
it shows me version 3.0.9, but when I run
rails -v
it shows me version 2.3.5 ( I don't know here that came from ).
See: http://cl.ly/353h1o1b3y3T260L3F3p
Any help please?
If you don't really care, just remove rails 2.3.5 with gem uninstall rails and chose the appropriate one when it asks you which.

Ubuntu 11.04 Ruby on Rails install write permissions error

I am trying to install rails and have installed rvm and am trying to install rails but it is saying I do not have write permissions.
$ gem install rails --version 3.0.7
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /var/lib/gems/1.8 directory.
When I try sudo it give me this error, I know that you can use --no-ri --no-r-doc but even when I did this rails was not installed properly. Does anyone have any ideas?
$ sudo gem install rails --version 3.0.7
Successfully installed rails-3.0.7
1 gem installed
Installing ri documentation for rails-3.0.7...
file 'lib' not found
Installing RDoc documentation for rails-3.0.7...
file 'lib' not found
from my experience with rvm, gems should't stay in /var/lib/
if you didn't specifically asked for this, there might be a problem with your rvm installation
if so, i would definetly recommend a clean rvm install by following ryan bigg's guide of installing rvm. i followed it every time and never ever had the slightest problem after.
hope this helps!