1

I installed RVM and Ruby through Cygwin on Windows 7. I am now trying to install Omega bundle following this guide. The command is

bundle install

Which gives an error 'command not found'. The solution for this is to install bundler via

gem install bundler

But this gives an 'Invalid byte sequence in UTF-8 error'. The solution for this is described in this post. But I don't understand where I should place this snippet.

require 'iconv' unless String.method_defined?(:encode)
if String.method_defined?(:encode)
  file_contents.encode!('UTF-8', 'UTF-8', :invalid => :replace)
else
  ic = Iconv.new('UTF-8', 'UTF-8//IGNORE')
  file_contents = ic.iconv(file_contents)
end

Please explain where to put this code in.

Thank you!

Community
  • 1
  • 1
banDeveloper
  • 38
  • 1
  • 6
  • 1
    This error message during `gem install ...` usually indicates a problem auto-generating documentation, but the gem should actually be installed. I usually ignore the message and use online documentation for affected gems. – Neil Slater Feb 26 '14 at 11:39
  • 1
    Hi Nick. Unfortunately the gem is not installed, as 'bundle install' still doesn't work. – banDeveloper Feb 26 '14 at 11:47
  • Did you perform the `gem install` in the root folder of your project (this may be necessary as `rvm` can switch Ruby versions automagically, so your install might go to one Ruby when you meant another...). Alternatively, is your error message "Bundler::GemfileNotFound"? That means something different . . . – Neil Slater Feb 26 '14 at 11:49
  • Hello, yes I tried installing in the root folder (where cygwin opens by default). The error I'm getting reads: ERROR: while executing gem ... (ArgumentError) invalid byte sequence in UTF-8. – banDeveloper Feb 26 '14 at 11:58

3 Answers3

7

I have 64 bit Cygwin, Ruby 2.0.0 and gem 2.4.1 and was experiencing the same issue. gem install ..., gem update, everything ended with "ERROR: While executing gem ... (ArgumentError) invalid byte sequence in UTF-8".

I had also all locales set to "en_US.UTF-8".

I have read somewhere that it should help to set LANG to an empty string or "C.BINARY", but it didn't help. But it was good hint to start experimenting.

Finally I have solved that by setting both LANG and LC_ALL to an empty string. All other locale environment variables (LC_CTYPE etc.) was automatically set to "C.UTF-8" by that, LANG and LC_ALL remained empty.

Now gem is finally working.


UPDATE

It seems that specifically LC_CTYPE is causing that issue if it's set to UTF-8. So setting it to C.BINARY should help. Other locale environment variables can be set to UTF-8 without affecting it.

export LC_CTYPE=C.BINARY

Community
  • 1
  • 1
David Ferenczy Rogožan
  • 23,966
  • 9
  • 79
  • 68
3

Just set character to something other than UTF-8 of Cygwin

Click left top icon --> Options --> Text --> set "Character set" to something (e.g. GBK)

xuxu
  • 6,374
  • 1
  • 17
  • 11
0

You can try this, it has worked for me:

> $ LANG=C.BINARY gem install bundler

You can find out more information here

djv
  • 15,168
  • 7
  • 48
  • 72