Tuesday, January 11, 2011

msvcrt-ruby18.dll Error on Windows.

When using ruby 1.9.2p136 (2010-12-25) [i386-mingw32], Rails 3.0.3, cucumber (0.10.0), cucumber-rails (0.3.2), and rspec (2.4.0) I was getting a windows error message saying that I don't have msvcrt-ruby18.dll and I need to fix it.

This is on a new ruby and rails set up. When I added my testing gems rspec and cucumber I started getting that error when I ran rake or started the webserver.

I commented out the testing gems and traced it to cucumber.

When looking at comment on Stack Overflow I noticed someone mentioned reinstalling json.

I looked to what version I had.

C:\web\used_be>gem list --local -d js

*** LOCAL GEMS ***

json (1.4.6)
Platform: x86-mingw32
Author: Florian Frank
Rubyforge: http://rubyforge.org/projects/json
Homepage: http://flori.github.com/json
Installed at: C:/Ruby192/lib/ruby/gems/1.9.1

JSON Implementation for Ruby

json_pure (1.4.6)
Author: Florian Frank
Rubyforge: http://rubyforge.org/projects/json
Homepage: http://flori.github.com/json
Installed at: C:/Ruby192/lib/ruby/gems/1.9.1

JSON Implementation for Ruby

OK. I installed the ruby version

C:\web\used_be>gem install json --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed json-1.4.6
1 gem installed
Installing ri documentation for json-1.4.6...
Installing RDoc documentation for json-1.4.6...
ERROR: While executing gem ... (Encoding::UndefinedConversionError)
U+2018 from UTF-8 to IBM437

What did that do?

C:\web\used_be>gem list --local -d js

*** LOCAL GEMS ***

json (1.4.6)
Platform: x86-mingw32
Author: Florian Frank
Rubyforge: http://rubyforge.org/projects/json
Homepage: http://flori.github.com/json
Installed at: C:/Ruby192/lib/ruby/gems/1.9.1

JSON Implementation for Ruby

json_pure (1.4.6)
Author: Florian Frank
Rubyforge: http://rubyforge.org/projects/json
Homepage: http://flori.github.com/json
Installed at: C:/Ruby192/lib/ruby/gems/1.9.1

JSON Implementation for Ruby

Looks the same. Let's unistall json.

C:\web\used_be>gem uninstall json

Select gem to uninstall:
1. json-1.4.6
2. json-1.4.6-x86-mingw32
3. All versions
> 2
Remove executables:
edit_json.rb, prettify_json.rb

in addition to the gem? [Yn] y
Removing edit_json.rb
Removing prettify_json.rb
Successfully uninstalled json-1.4.6-x86-mingw32

let's reinstall json.

C:\web\used_be>gem install json --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed json-1.4.6
1 gem installed
Installing ri documentation for json-1.4.6...
Installing RDoc documentation for json-1.4.6...
ERROR: While executing gem ... (Encoding::UndefinedConversionError)
U+2018 from UTF-8 to IBM437

What did that do?

C:\web\used_be>gem list --local -d js

*** LOCAL GEMS ***

json (1.4.6)
Author: Florian Frank
Rubyforge: http://rubyforge.org/projects/json
Homepage: http://flori.github.com/json
Installed at: C:/Ruby192/lib/ruby/gems/1.9.1

JSON Implementation for Ruby

json_pure (1.4.6)
Author: Florian Frank
Rubyforge: http://rubyforge.org/projects/json
Homepage: http://flori.github.com/json
Installed at: C:/Ruby192/lib/ruby/gems/1.9.1

JSON Implementation for Ruby

Now I can run rake tasks or start the server and not get that error.