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.
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've been following along with the Lynda.com's Ruby on Rails course. I did everything just as mentioned inside the videos.
I am trying to run the rails server command, which should default to WEBrick, correct?
I run the command and it has an issue in the nokogiri.rb file and on line 29 where the error is happening this is what is read:
require 'nokogiri/nokogiri'
Which is what my command prompt is throwing up on when running the rails server command. Any idea what could be causing this? If so, what commands do I need to run to settle this? To me it sounds like something was missed when installing MySQL.
I am not sure what nokogiri is and why rails server won't run and points to that line of code.
The path to this file is (Wherever you installed the folder to)\lib\ruby\gems\2.2.0\gems\nokogiri-1.6.6.2-x64-mingw32\lib
EDIT**: I have a chain of errors, like it goes from -long path-, from -longpath- etcetera. I tried installing the latest gem, and it wasn't successful. Is there a log file I can get to share with you guys to help figure out the issue.
nokogiri is a Ruby "gem" (library) for parsing XML and HTML.
Your Rails project should have a Gemfile which specifies the name and version of each gem needed to run the project. To install the gems listed in the gemfile:
bundle install
After that install completes successfully, Rails should be able to find the nokogiri gem.
Try this
$ sudo apt-get install libxslt-dev libxml2-dev zlib1g-dev
$ sudo gem install nokogiri -v '1.5.11'
According to \lib\ruby\gems\2.2.0\gems\nokogiri-1.6.6.2-x64-mingw32\lib, which means that you are running it on Windows platform. You are using ruby 2.2.0.
I know that nokogiri conflicts with 2.2.* versions of ruby in Windows. I have already encountered this problem. I think it is because of mingw32.
You need to install 2.1.* version of Ruby in order to make Nokogiri work.
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
I've been having a tough time getting jRuby on Rails 3 deployed on Tomcat 6. I got it to work exactly once.
I modified my database.yaml and Gemfile to check for jRuby, something like this:
if defined?(JRUBY_VERSION)
gem 'jdbc-mysql'
#gem 'jdbc-sqlite3'
gem 'activerecord-jdbc-adapter'
gem 'activerecord-jdbcmysql-adapter'
#gem 'activerecord-jdbcsqlite3-adapter'
gem 'jruby-openssl'
gem 'jruby-rack'
gem 'warbler'
else
gem 'mysql'
gem "mongrel"
gem 'ruby-debug'
end
Some environment settings:
$ rvm -v
rvm 1.0.14
$ jruby -v
jruby 1.5.3 (ruby 1.8.7 patchlevel 249) (2010-09-28 7ca06d7) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_20) [x86_64-java]
When I run jruby -S bundle install everything goes smoothly.
It's when I try to do something like rake db:migrate, jruby -S rake db:migrate or warble that I get 50 DEPRECATION WARNINGs and an eventual stackoverflow.
I solved this issue by deleting the warbler plugin, it did not like the line Warbler::Task.new
Next, I ran warble config to give me a config/warbler.rb file.
And finally, warble to create my .war file. So far so good.
Now I move the .war file to my Tomcat webapps. Everything works fine except for an error:
Oct 10, 2010 1:34:46 AM org.apache.catalina.core.ApplicationContext log
SEVERE: Application Error
org.jruby.rack.RackInitializationException:
http://github.com/plataformatec/devise.git (at master) is not checked out.
Please run 'bundle install'
I solved this problem once and only once by going into my webapps/myapp/WEB-INF and running jruby -S bundle install
It no longer works and I have no idea what is going on.
I believe this can be called a bug in the current version of Warbler. Using git repositories in your Gemfile don't quite get staged properly in the war file and Bundler is still looking for a checked out repository on disk.
A future version of Warbler will probably do something along the lines of bundle --deployment when you create the war file.
For now, to work around, you might have to vendor the devise code.
The current version of warbler (1.3.6) will also exhibit this behavior if you build a war file with warbler war. I've found that building with the following command works:
warbler compiled war
Hopefully future versions will address this more completely.
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