9

Today I've reinstalled my Mac and I had to reinstall rails etc too. Now I've set up everything correctly ( at least I hoped ), but I keep running into a very annoying error.

$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...

ArgumentError: invalid byte sequence in UTF-8
An error occurred while installing rake (10.1.0), and Bundler cannot continue.
Make sure that `gem install rake -v '10.1.0'` succeeds before bundling.

Now I thought reinstalling "rake" would solve the problem, but it didn't. I've followed this blog post, but it didn't solve my problem neither, because there're no files in the "/etc/paths.d" folder.

$ ls -a /etc/paths.d
.   ..

So I've tried to change my .bashrc file as suggested in an other blog post. But this didn't work out neither.

# .bashrc file
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

# Make sure the UTF-8 locale is set correctly
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"

I also tried to delete and reinstall rails, but this didn't solve the problem neither. So do you guys have any suggestions where to look?


Update

I was able to "solve" this problem by removing RVM and Rails and using RBenv instead. I know this is not a solution to the problem, but now it does work.

Stefan
  • 434
  • 1
  • 5
  • 10

6 Answers6

24

You should first update Rubygems:

gem update --system

And then update Bundler:

gem install bundler

source: NoMethodError: private method `open' called for Gem::Package:Class An error occurred while installing rake (10.0.3), and Bundler cannot continue

Community
  • 1
  • 1
Slim Fadi
  • 1,076
  • 10
  • 14
1

I had a similar problem on a windows machine. Well the problem is that the certificate needs to be updated. Check this out - https://gist.github.com/luislavena/f064211759ee0f806c88

  • event if that link has the solution, Please include the most important points in the Answer http://stackoverflow.com/help/how-to-answer – MZaragoza Mar 30 '15 at 18:26
  • There aren't that many salient points - the certificate needs to be downloaded and stored somewhere (e.g. the RailsInstaller folder), and an environment variable set to point to it. Here's another GitHub article discussing it. https://gist.github.com/fnichol/867550 – Martin Greenaway Aug 17 '15 at 13:06
1

I ran into this problem developing on a Windows machine. The SSL certificate needs to be updated, which can be done by following these steps:

Step 1: Obtain the new trust certificate

We need to download AddTrustExternalCARoot-2048.pem.

Use the above link and place/save this file somewhere you can later find easily (eg. your Desktop).

IMPORTANT: File must have .pem as extension. Browsers like Chrome will try to save it as plain text file. Ensure you change the filename to have .pem in it after you have downloaded it.

Step 2: Locate RubyGems certificate directory in your installation

In order for us copy this file, we need to know where to put it.

Depending on where you installed Ruby, the directory will be different.

Take for example the default installation of Ruby 2.1.5, placed in C:\Ruby21

Open a Command Prompt and type in:

C:>gem which rubygems C:/Ruby21/lib/ruby/2.1.0/rubygems.rb Now, let's locate that directory. From within the same window, enter the path part up to the file extension, but using backslashes instead:

C:>start C:\Ruby21\lib\ruby\2.1.0\rubygems This will open a Explorer window inside the directory we indicated.

Step 3: Copy new trust certificate

Now, locate ssl_certs directory and copy the .pem file we obtained from previous step inside.

It will be listed with other files like GeoTrustGlobalCA.pem.

Thanks to this link for supplying the information I needed: https://gist.github.com/luislavena/f064211759ee0f806c88

TechnoTony
  • 1,587
  • 1
  • 15
  • 24
0

I ran into the same problem when I was learning rails tutorial 4 by Michael Hartl.

I tried to bundle install in my old version "sample_app_rails_4" while I just updated my rails to version 4.0.1.

I solved this problem by just git clone the newest version "sample_app_rails_4".

Jeffrey
  • 396
  • 3
  • 4
0

Very important because this is not error its warning only so no problem at all. Please go to C:\RailsInstaller\Ruby2.1.0\lib\ruby\2.1.0\dl.rb

Means to say find dl.rb And then find warn "DL is deprecated, please use Fiddle" and place # before this line means make this comment and this become

#warn "DL is deprecated, please use Fiddle"

Problem solved.

Scott Weldon
  • 9,673
  • 6
  • 48
  • 67
  • @JaiKumarRajput For code, filenames, errors, and other code-like artifacts, please don't use **bold** text, but escape with ```backticks (`)```. See the Help Center's [formatting guidelines](//stackoverflow.com/help/formatting). – Scott Weldon Oct 18 '16 at 00:04
0

Adding a tag flag to the gem in Gemfile fixed to me, not sure why though.

Lucas Caton
  • 3,027
  • 1
  • 24
  • 34