An error occurred while installing rake (10.1.0), and Bundler cannot continue

15,915

Solution 1

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

Solution 2

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

Solution 3

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

Share:
15,915
Stefan
Author by

Stefan

Updated on July 22, 2022

Comments

  • Stefan
    Stefan almost 2 years

    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.

  • MZaragoza
    MZaragoza about 9 years
    event if that link has the solution, Please include the most important points in the Answer stackoverflow.com/help/how-to-answer
  • Martin Greenaway
    Martin Greenaway over 8 years
    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. gist.github.com/fnichol/867550
  • Scott Weldon
    Scott Weldon over 7 years
    @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.