I'm wondering why i got this error on particular situation.
One of my controller class has
require 'Kconv'
on top.
And after running app by "$ rails s", i got this error (cannot load such file -- Kconv) in only my centos5.10. My mac has no problem with the code and can work correctly.
Specs
My mac
Rails 4.2.0
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]
gem 2.2.2
Yosemite 10.10.2
centos5.10
Rails 4.2.0
ruby 2.1.2p95 (2014-05-08 revision 45877) [i686-linux]
gem 2.4.8
CentOS release 5.10 (Final)
And one of tutorial site mentioned about need to install 'Kconv' by gem.
But both of my pc has error with it.
ERROR: Could not find a valid gem 'kconv' (>= 0) in any repository
ERROR: Possible alternatives: bconv, conv, iconv, sconv
My question is why this error happens even if these specs are almost same. Another tutorial site said this lib is included into general package. If so, if i use same ruby version, i don't get this error, do i?
The name of the file is kconv.rb, not Kconv.rb. On your Mac, you are presumably using a case-insensitive file system such as FAT, NTFS or HFS, whereas on your CentOS box, you are using a case-sensitive file system such as ext4, btrfs or ZFS.
So, it should be
require 'kconv'
and the fact that
require 'Kconv'
works on a case-insensitive file system is just pure dumb luck.
Related
The Ruby Version set on my windows machine is:
ruby 1.9.3p392 (2013-02-22) [i386-mingw32]
I have tried running the ruby installer for Ruby 2.0.0 but cannot seem to get it to replace the 1.9.3p392.
Now I am working in a tutorial that requires the gem 'monbon' - but when I run bundle on a new app, I get the message:
Could not find gem 'monbon' (= 0.0.6) x86-mingw32' in the gems available on this machine.
Is the patch on the Ruby causing this error and why?
What are some steps I can take to just run Ruby 1.9.3 or 2.0.0?
Any further code or screen shots I can take to help diagnose issue?
EDIT TO ADD SOLUTION:
I was able to install Pik
(https://github.com/vertiginous/pik)
by following this tutorial
(http://puneetpandey.com/tag/how-to-install-and-configure-pik-on-windows/)
and solving an error by this stack overflow questions (installing pik in system path in windows)
Then I installed Ruby 2.0.0 and also the exact Ruby version and patch from the tutorial using Pik.
Firstly, this 'strange patch' is perfectly normal and expected. It tells you the patchlevel that has been applied to your ruby 1.9.3 installation. And patches are good - they generally are used to fix security and stability issues.
Secondly, the [i386-mingw32] is there to let you know that you are using the Windows flavor (or 'i386-mingw32' flavor to be more correct) of ruby. This is important, because not all gems necessarily support all OS's without some tweaking. Many of them need to be compiled, and the instructions for doing so can differ from OS to OS. Now on to your list:
The strange patch is not causing the error.
The steps you can take to run the correct Ruby are - install pik. It lets you choose the right version of ruby whenever you want. And it lets you set the default version when you don't want to think about it.
Nothing to diagnose, everything is running as expected. The gem can't be found for the i386-mingw32 ruby flavor. Check with your 'monbon' gem author to see if and how this can be resolved.
I am trying to set my machine up so I can follow this tutorial: the intro to rails screen-cast i wish i had.
I keep running into issues, most recently the following:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/ansi-1.4.1/lib/ansi/code.rb:5:in `require':
no such file to load -- Win32/Console/ANSI (LoadError)
This occurs when ever I run rails g. (I would like to see if my r spec generator has been added.)
Environment details: Windows 7, ruby 1.9.2p290, rails 3.1.1, rubygems 1.8.15
After you installed "gem install win32console", can you add this gem into your Gemfile file and try to run bundle install again?
Gemfile
gem "win32console", "~> 1.3.0"
RailsInstaller may be your best bet if you're looking for an integrated Windows Rails experience.
It's up-to-date (-ish, doesn't use Ruby 1.9.3) with:
Ruby 1.9.2-p290
Rails 3.1.1
Git 1.7.6
and other useful bits.
TLDR: How do I force a rails app to use the correct ruby interpreter?
Hello,
Something hosed parts of my Ruby 1.9.2p290 install (certain classes just went missing one day), so I removed it and attempted to reinstall the environment.
I'm running on Snow Leopard.
Ruby 1.9.2 was installed from source. (I tried to install via MacPorts and it would fail). I am not keen on RVM as I use bundler and I seem to recall some problems with how bundler and RVM interact, though from what I can tell RVM works.
After reinstalling a few gems I noticed they were being placed in a gem folder for Ruby 1.8. "This is weird," I thought.
Starting up the rails app, I notice a lot of weird exceptions being thrown regarding syntax. After printing RUBY_VERSION to stdout, I noticed that the Rails app is running 1.8.7.
which ruby shows only one ruby interpreter:
$ which ruby
/usr/bin/ruby
$ /usr/bin/ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
If I open up Activity Monitor, the ruby process from the Rails app lives at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby, which I believe is the ruby interpreter that OSX shipped with.
I haven't found any information on completely purging Ruby from OSX. I would love to do that then simply install ruby from source.
It seems there are two problems:
Rails is running a ruby interpreter that I have no idea how it is calling, when I need it to run the 1.9.2 interpreter installed from source
gems are being installed in a 1.8 folder, I suspect because gem thinks its running under 1.8
How do I fix this?
Thank you,
Tom
I guess the best way to overcome this issue is using rvm to handle your Ruby and Rails environments through 'gemset's.
I had the same issue and I use gemsets now without a problem.
This is the article which I got things working:
http://stjhimy.com/posts/10-five-quick-steps-to-set-up-rvm-with-rails-2-and-rails3
I used RVM to upgrade Ruby 1.9.2 from patch level p180 to p290:
rvm upgrade 1.9.2-p180 1.9.2-p290
Then, I used these commands to update my Rails gem and other gems
gem install rails 3.0.5
gem update
Everything seems to be fine; rvm info shows all Ruby binaries and gems have been moved to the correct p290 path (~/.rvm/*/ruby-1.9.2-p290/*).
However, when I go to my Rails application directory and issue the command rails console, I get the error message saying a gem (activesupport-3.0.5) cannot load the libruby.1.9.1.dylib file.
10:30 AM ~/Development/rails_projects/my_app_0515 $ rails console
/Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require': dlopen(/Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle, 9): Library not loaded: /Users/whk/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.1.9.1.dylib (LoadError)
Referenced from: /Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle
Reason: image not found - /Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle
. . .
Rails can't find the dylib file in ~/.rvm/rubies/ruby-1.9.2-p180/lib, because the p180 path no longer exists, but the file is in ~/.rvm/rubies/ruby-1.9.2-p290/lib.
From a separate StackOverflow post, I found a workaround is adding this line to .bashrc
export DYLD_LIBRARY_PATH="/Users/whk/.rvm/rubies/ruby-1.9.2-p290/lib:$DYLD_LIBRARY_PATH"
However, I want to understand why the rvm ruby upgrade doesn't take care of the lib path change? Does anyone know a cleaner solution -- one that removes the p180 path from where it is configured?
Here are my environment:
Mac OS X 10.6.6 (Snow Leopard)
rvm 1.8.4
ruby 1.9.2p290
Rails 3.0.5
Thanks!
the problem was in gems native extension - their were nto rebuild during rvm upgrade 1.9.2-p180 1.9.2-p290 - next time please have closer look on the output ... it should give your information what's wrong.
as for this particular use case it shoudl be enough to reinstall the given gem:
gem install serialport -v 1.0.4
... not sure if it should be uninstalled first
I just tried to play with Ruby on Rails on Snow Leopard.
I was following this tutorial:
http://developer.apple.com/tools/rubyonrails.html
Whatever I try to do with rails I end up with:
MacBook-Pro-lm:~ lukasz$ rails blog
**undefined method `camelize' for "app":String**
MacBook-Pro-lm:~ lukasz$ rails --help
**undefined method `camelize' for "app":String**
Really basic things... however - verbosing rails works:
MacBook-Pro-lm:bin lukasz$ rails -v
Rails 2.3.5
MacBook-Pro-lm:~ lukasz$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10]
MacBook-Pro-lm:bin lukasz$ gem -v
1.3.7
So it seems I have installed and upgarded ruby (using macports), rubygems and rails successfully (according to terminal). There are also few other packages installed to support we development like passenger and mysql5, etc...
I can find ruby installed in the
/opt/local/bin directory. My environment PATH variable is:
PATH=/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
The is something fishy going on. It must be some stupid basic problem. Google says that there could be a problem with ruby-iconv library but I can not find/install this package using port or gem commands.
Plese help.... what am I missing here?
You might want to try to check where the gem was installed:
gem list -d rails
Compare the gem installation directory with other gems that rails needs. It seems to me that it is a ruby gems issue. Make sure all the gems was installed with macports version of rubygems. It is not possible to mix and match.
Hopefully it helps.