'I'm getting "Error 403" when installing rails

I'm trying to install rails -v 5.2.2 on wsl ubuntu 18.04. Im met with following error:

ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    bad response Forbidden 403 (https://api.rubygems.org/quick/Marshal.4.8/nokogiri-1.13.3-x64-unknown.gemspec.rz)

I'm relatively new to bash and I'm not sure what to do at this point, as google failed me. Help? :)



Solution 1:[1]

I had the same issue with -v 5.2.3. What worked for me was updating RubyGems with:

gem update --system

Then again:

gem install rails --version 5.2.3 

and no issues this time.

Solution 2:[2]

Solution 1: As proposed by @Unixmonkey downloading the gem on separate machine with no restrictions and copying the gemfile worked.

Solution 2: Installing ruby through RVM and trusting its certificates

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeremy Caney
Solution 2 Egilzzz