I'm using jruby 1.7.2 and setting up a new rails app. Bundler appears unable to find the necessary (java/jruby based gems) to use:
> bundle
Could not find gem 'neo4j-core (>= 0) ruby' in the gems available on this machine.
If I specify the path, I get this:
> bundle
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Could not find gem 'neo4j-core (>= 0) ruby' in source at ./vendor/gems/neo4j-core.
Source contains 'neo4j-core' at: 2.0.1
Perhaps bundler is getting confused about its platoform -- why would it be tacking the word ruby on the end there? I ran ruby -e "puts RUBY_PLATFORM", which gave me: java
Solved by deleting Gemfile.lock: https://github.com/carlhuda/bundler/issues/2043
Related
Whenever I run the bundle exec jekyll serve it returns the error
Dependency Error: Yikes! It looks like you don't have kramdown-parser-gfm or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- kramdown-parser-gfm' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
Liquid Exception: kramdown-parser-gfm in /_layouts/default.html
ERROR: YOUR SITE COULD NOT BE BUILT:
------------------------------------
kramdown-parser-gfm
so, I tried gem install kramdown-parser-gfm, but it returns the same error after that.
I also tried to remove and reinstall the jekyll and bundle, but didn't work either.
jekyll version 3.9.0 Bundler version 2.1.4
I added gem "kramdown-parser-gfm" to the Gemfile and then ran bundle install.
Now the serve command completes successfully.
delete the Gemfile.lock file
go to gem file add gem "kramdown-parser-gfm"
open terminal and give command bundler
after install all packages, in terminal give command bundle exec jekyll serve
I hope application will run properly now.
On Windows
If you open your gemfile, you will notice the following.
gem "jekyll", "~> 3.2.1"
If you have the specific jekyll version and after running "bundler", you will receive the following errors.
Bundler could not find compatible versions for gem "kramdown":
In Gemfile:
jekyll (~> 3.2.1) was resolved to 3.2.1, which depends on
kramdown (~> 1.3)
kramdown-parser-gfm was resolved to 1.1.0, which depends on
kramdown (~> 2.0)
Remove the specific version of jekyll, like so:
gem "jekyll"
Do not forget to add webrick gem to gemfile
gem "webrick"
Run bundler again.
bundler
Finally, serve
bundle exec jekyll serve --livereload
What worked for me was to add:
gem "rexml"
to the Gemfile.
I have a Ruby on Rails app that I want to compile/package as a WAR file to host in Tomcat. I've added all of the relevant stuff I can find, but the WAR only appears to include the non-JRuby versions of gems. As a result, I get GemNotFound exceptions such as "could not find activerecord-jdbc-adapter" in Tomcat. If I open the WAR file in 7-zip, it does not show any of the JRuby or Java gems under /WEB-INF/gems/gems.
Warbler does not report any errors or warnings, and the WAR appears to contain everything it needs, except for these gems.
(Because this is a lightweight, internal app, I'm using sqlite for now... which explains the sqlite gems. The DB is stored outside the project and configured in the database.yml file.)
The relevant snippet from my Gemfile:
if defined?(JRUBY_VERSION)
gem 'jdbc-sqlite3'
gem 'activerecord-jdbc-adapter'
gem 'activerecord-jdbcsqlite3-adapter'
gem 'jruby-openssl'
gem 'jruby-rack'
else
gem 'sqlite3'
end
I also tried explicitly including/excluding these gems in the warble.rb file:
config.gems -= ["sqlite3"]
config.gems += [
"jdbc-sqlite3",
"activerecord-jdbc-adapter",
"activerecord-jdbcsqlite3-adapter",
"jruby-openssl",
"jruby-rack",
"warbler"
]
As an interesting side note, if I modify my Gemfile to demand the JRuby gems, jruby -S bundle install works fine but warble gives a series of errors stating that the gems are only for use with JRuby. On the other hand, if I try to run it within JRuby (jruby -S warble) I get:
warble aborted!
no such file to load -- jruby_pageant
How can I convince Warbler that I want the JRuby gems?
Edit:
I also tried specifying platforms in the gemfile, as described in this blog post, but this causes warble to stack-overflow.
platforms :jruby do
gem 'jdbc-sqlite3'
gem 'activerecord-jdbc-adapter', :require => false
gem 'activerecord-jdbcsqlite3-adapter', :require => false
gem 'jruby-openssl'
gem 'jruby-rack'
end
platforms :ruby do
gem 'sqlite3'
end
Versions:
ruby 1.9.3
jruby 1.7.4
warbler 1.3.8
So it turns out that I was missing the jruby-pageant gem. Once I added this to the bundle, jruby -S warble produced the expected output.
I was trying to create a jruby application using jruby -S rails new OSTH_GGG.
But it returns jruby: No such file or directory -- rails (LoadError).
What is the problem?
Make sure the rails gem is installed:
jruby -S gem install rails
See also this answer to get more details on how to get started with JRuby on Rails.
I built my Rails 3 app using sqlite and now I'm trying to switch over to MySQL.
I created a new MySQL db, changed database.yml accordingly, and I added an older version of the mysql2 gem to my gemfile (gem 'mysql2', '< 0.3') which is supposed to play nicer with Rails 3.
I can start the dev server fine. When I visit a page, I get a Mysql2::Error (Table 'twitter_quiz_development.users' doesn't exist). Which is fine--I still need to add the schema to the new db. This is where I run into trouble:
rake db:schema:load returns this nasty error.
The solution found here did not work for me. gem pristine --all return this.
I'm running Ubuntu 11 if that helps.
It appears that the error has to do with JSON but I have no idea how to solve this. Thanks.
The issue(s) you are experiencing could be due to 3 things:
The version of Ruby you are using
The use of the SystemTimer gem with Ruby 1.9
The JSON gem
I've elaborated below...
The first thing I would suggest is to upgrade your version of Ruby 1.9. The latest stable is:
ruby 1.9.2p180 (2011-02-18 revision 30909)
I would highly recommend using Ruby Version Manager (RVM) to install and manage Rubies.
In terms of using the JSON gem, have a look at:
http://ruby.about.com/od/tasks/a/The-Json-Gem.htm
To quote:
On Ruby 1.8.7, you'll need to install a gem. However, in Ruby 1.9.2, the json gem is bundled with the core Ruby distribution. So, if you're using 1.9.2, you're probably all set. If you're on 1.8.7, you'll need to install a gem.
Before you install the JSON gem, first realize that this gem is distrubuted in two variants. Simply installing this gem with gem install json will install the C extension variant. This requires a C compiler to install, and may not be available or appropriate on all systems. Though if you can install this version, you should.
If you can't install the C extension version, you should gem install json_pure instead. This is the same gem implemented in pure Ruby. It should run everywhere that Ruby code runs, on all platforms and on a variety of interpreters. However, it's considerably slower than the C extension version.
Edit:
Looks like you should avoid using the SystemTimer gem with Ruby 1.9. See this for more info: http://isitruby19.com/systemtimer
To quote a comment made on that page by Phillipe:
I am the (co)-author of this gem. Short story : Using this gem in Ruby 1.9 is useless and does not make any sense!
System Timer is trying to work around some limitation of the "green thread" model used in Ruby 1.8 (MRI). See http://ph7spot.com/musings/system-timer for more details.
It is then irrelevant in a Ruby 1.9 which abandoned the green thread model and embraced native threads (kind of since there is still a global interpreter lock).
Cheers,
- Philippe
Your gem pristine --all looks like it errored out with the SystemTimer gem before it got to the json gem. Is that gem used in the Rails app in question?
Are you using RVM? If so, I'd manually remove the SystemTimer and json gems and their binaries (if any) from ~/.rvm/gems/ruby-whatever-version/ (in the gem and bin subdirectories).
Try to update to the latest version of the JSON gem (1.5.1) by adding this to your Gemfile:
gem "json", "1.5.1"
And then run bundle install to install SystemTimer and the later version of the json gem.
I have intalled EventMachine in JRuby (I am using Win32). When I try the server example, I get an error when
require 'eventmachine'
The error is:
C:\dev\em>jruby server.rb
server.rb:1:in `require': no such file to load -- eventmachine (LoadError)
from server.rb:1
But the gem is installed!
C:\dev\myapp>jruby -S gem install eventmachine
Successfully installed eventmachine-0.12.8-java
1 gem installed
Installing ri documentation for eventmachine-0.12.8-java...
Installing RDoc documentation for eventmachine-0.12.8-java...
Could not find main page README
Could not find main page README
Could not find main page README
Could not find main page README
You need to first load RubyGems,
require 'rubygems'
The gem may not be installed for jruby. Try jgem install eventmachine