`gem install <package>` 404 Not Found, Error: Gem::RemoteFetcher::FetchError - ruby-on-rails

I'm having a difficulty with RubyGem.
Environment
Windows 64-bit
Using Git-Bash in VSCode
Ruby 3.2.0 + devkit installed from rubyinstaller.org
Problem
run gem install bundler provides this error message:
$ gem install bundler -V
HEAD https://index.rubygems.org/
200 OK
GET https://index.rubygems.org/info/Kim/.local/share/gem/ruby/3.2.0
404 Not Found
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Not Found 404 (https://index.rubygems.org/info/Kim/.local/share/gem/ruby/3.2.0)
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/remote_fetcher.rb:232:in `fetch_http'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/remote_fetcher.rb:248:in `fetch_path'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/resolver/api_set.rb:105:in `versions'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/resolver/api_set.rb:56:in `find_all'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/resolver/composed_set.rb:54:in `block in find_all'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/resolver/composed_set.rb:53:in `map'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/resolver/composed_set.rb:53:in `find_all'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/resolver/best_set.rb:30:in `find_all'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/resolver/installer_set.rb:170:in `find_all'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/resolver/installer_set.rb:61:in `add_always_install'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/dependency_installer.rb:322:in `resolve_dependencies'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/commands/install_command.rb:201:in `install_gem'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/commands/install_command.rb:226:in `block in install_gems'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/commands/install_command.rb:219:in `each'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/commands/install_command.rb:219:in `install_gems'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/commands/install_command.rb:167:in `execute'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/command.rb:323:in `invoke_with_build_args'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/command_manager.rb:185:in `process_args'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/command_manager.rb:149:in `run'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/gem_runner.rb:51:in `run'
C:/Ruby31-x64/bin/gem:21:in `<main>'
run gem env provides this error message:
$ gem env
ERROR: While executing gem ... (Gem::CommandLineError)
Unknown environment option [Kim/.local/share/gem/ruby/3.2.0]
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/commands/environment_command.rb:93:in `execute'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/command.rb:323:in `invoke_with_build_args'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/command_manager.rb:185:in `process_args'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/command_manager.rb:149:in `run'
C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/gem_runner.rb:51:in `run'
What could be the cause of this problem?
What steps can I follow to solve this issue?
Thanks.

These lines indicate that your shell environment is misconfigured:
GET https://index.rubygems.org/info/Kim/.local/share/gem/ruby/3.2.0
404 Not Found
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Not Found 404 (https://index.rubygems.org/info/Kim/.local/share/gem/ruby/3.2.0)
You should instead see this:
HEAD https://index.rubygems.org/
200 OK
GET https://index.rubygems.org/info/bundler
200 OK
This line also indicates a misconfiguration:
Unknown environment option [Kim/.local/share/gem/ruby/3.2.0]
This is most likely caused by the gemrc or .gemrc file having incorrect contents. The location of this file on Windows varies so I would recommend looking in the following locations for it:
%USERPROFILE% (typically C:\Users\<your username>
C:\ProgramData
C:\Ruby31-x64
If you can't find the file in any of those locations then perform a search of C:\ to find it.
Once you've found it you can either edit the file to remove the invalid values or you can delete it entirely. (or more preferably, rename it so that you can restore it if necessary)

Related

Heroku create gives "Permission denied # rb_sysopen "

I had created a project using "heroku create". After changing the name the domain URL was not working so I deleted the project.
Now I'm executing "heroku create" but it is giving an error. I tried many solutions but none of them are working for me. kindly help.
ANAMIKA#W1650044 MINGW64 /c/Sites/myrubyblog (master)
$ heroku create
WARNING: This is the legacy Heroku CLI with limited functionality. Please install the latest CLI.
WARNING: Installation instructions are at https://cli.heroku.com
heroku-cli: Installing CLI... 24.45MB/24.45MBPermission denied # rb_sysopen - C:\Users\ANAMIKA\AppData\Local/heroku/cli/lib/node.exe
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:107:in `initialize'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:107:in `open'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:107:in `block (4 levels) in setup'
C:/Program Files (x86)/Heroku/ruby-2.1.7/lib/ruby/2.1.0/rubygems/package/tar_reader.rb:64:in `each'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:98:in `block (3 levels) in setup'
C:/Program Files (x86)/Heroku/ruby-2.1.7/lib/ruby/2.1.0/rubygems/package/tar_reader.rb:28:in `new'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:96:in `block (2 levels) in setup'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:95:in `open'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:95:in `block in setup'
C:/Program Files (x86)/Heroku/ruby-2.1.7/lib/ruby/2.1.0/tmpdir.rb:88:in `mktmpdir'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:63:in `setup'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/cli.rb:42:in `start'
C:/Program Files (x86)/Heroku/bin/heroku:29:in `<main>'
! Heroku client internal error.
! Search for help at: https://help.heroku.com
! Or report a bug at: https://github.com/heroku/heroku/issues/new
Error: Permission denied # rb_sysopen - C:\Users\ANAMIKA\AppData\Local/heroku/cli/lib/node.exe (Errno::EACCES)
Command: heroku create
Version: heroku/toolbelt/3.99.3 (i386-mingw32) ruby/2.1.7
More information in C:/Users/ANAMIKA/.heroku/error.log
this is saying that you need to update your heroku cli, here are the instructions
depending on the way you installed it, you can update it running
heroku update
or
sudo apt-get update && sudo apt-get upgrade heroku

Debugging ruby in RubyMine

I am new to Ruby and RubyMine but I have tried essentially everything I have found online but can't get the debugger to work in RubyMine, keep getting the following error:
Error running 'simple_array_sum': Failed to Install Gems. Following gems were not installed: /Applications/RubyMine.app/Contents/rb/gems/ruby-debug-ide-0.6.1.beta9.gem: Error installing ruby-debug-ide-0.6.1.beta9.gem: ERROR: Failed to build gem native extension. current directory: /Users/ruskindantra/.gem/ruby/2.3.0/gems/ruby-debug-ide-0.6.1.beta9/ext /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby mkrf_conf.rb Installing base gem Permission denied # dir_s_mkdir - /Library/Ruby /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:253:in `mkdir' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:253:in `fu_mkdir' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:227:in `block (2 levels) in mkdir_p' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:225:in `reverse_each' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:225:in `block in mkdir_p' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:211:in `each' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/fileutils.rb:211:in `mkdir_p' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/installer.rb:691:in `verify_gem_home' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/installer.rb:811:in `pre_install_checks' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/installer.rb:278:in `install' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/resolver/specification.rb:97:in `install' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/request_set.rb:166:in `block in install' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/request_set.rb:156:in `each' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/request_set.rb:156:in `install' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/dependency_installer.rb:405:in `install' mkrf_conf.rb:35:in `rescue in ' mkrf_conf.rb:28:in ` ' rake failed, exit code 1 Gem files will remain installed in /Users/ruskindantra/.gem/ruby/2.3.0/gems/ruby-debug-ide-0.6.1.beta9 for inspection. Results logged to /Users/ruskindantra/.gem/ruby/2.3.0/extensions/universal-darwin-17/2.3.0/ruby-debug-ide-0.6.1.beta9/gem_make.out
Can anyone please help?
The problem is that RubyMine is pointing at the system version of Ruby. I would recommend starting with a Ruby version manager of some sort, such as rbenv
From there, you can install a version Ruby under your home directory using the version manager, and then tell RubyMine to point to it (Preferences -> Languages & Frameworks -> Ruby SDK and Gems -> [pick the version manager-installed Ruby you installed].
This may be a bit involved if you're just getting started, but it avoids polluting the gems folder of the system version of Ruby.
This is what worked for me:
Updated rubymine with toolbox to the newest version
Click "debug" on your app once you set up your configuration
Get the following error message:
Go to the problematic directory (in this case /Users/lizzie/.gem/ruby/2.7.0)
Click "Get Info" on the directory: 
Click the lock button on the bottom right and put in your password, give everyone read & write access, and finally click the action menu and select "Apply to enclosed folders":

Permission error on shared host for gem command

I'm getting an error each time I attempt to use gem install sass (or gem install anything, really).
/usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91:in `read': Permission denied - /usr/lib/ruby/gems/1.8/specifications/passenger-3.0.18.gemspec (Errno::EACCES)
from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91:in `load_specification'
from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:153:in `load_gems_in'
from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:152:in `each'
from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:152:in `load_gems_in'
from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:149:in `reverse_each'
from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:149:in `load_gems_in'
from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:345:in `refresh!'
from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:78:in `from_gems_in'
from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:58:in `from_installed_gems'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:883:in `source_index'
from /usr/lib/ruby/site_ruby/1.8/rubygems/gem_path_searcher.rb:81:in `init_gemspecs'
from /usr/lib/ruby/site_ruby/1.8/rubygems/gem_path_searcher.rb:13:in `initialize'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:841:in `new'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:841:in `searcher'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:840:in `synchronize'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:840:in `searcher'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:479:in `find_files'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:983:in `load_plugins'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:1139
from /usr/bin/gem:8:in `require'
from /usr/bin/gem:8
Because this is a shared host, I don't have access to /usr/lib/ruby. I contacted a2hosting but they told me they don't support Ruby on Rails and to post about it here. So I guess that's an indication that there is some way to fix it myself? There is a RubyGems app on the a2hosting CPanel, but it doesn't work either:
I suspect this is because it just uses the same commands I'm using, and thus throws the same error.
I have installed rvm on the server, however. Perhaps there is a workaround using that?

Ruby on rails on Jailed shell cpanel on centos

I am trying to install ruby on rails on a shared server with Cpanel with Jailed Shell on SSH.
I've this
-jailshell: rbenv: command not found
when server is starting.
After downloading the Ruby tar package, I navigated inside the folder and ran the commands,
make
and
make install
and
./configure --prefix=/usr/local/ruby -exec-prefix=/usr/local/ruby
once and it didn't work
tried even this
./configure --prefix=/usr/local/ -exec-prefix=/usr/local/
the command make install results in the following
Permission denied # dir_s_mkdir - /usr/local/ruby (Errno::EACCES)
from /home/username/ruby-2.1.1/lib/fileutils.rb:247:in `fu_mkdir'
from /home/username/ruby-2.1.1/lib/fileutils.rb:224:in `block (2 levels) in mkdir_p'
from /home/username/ruby-2.1.1/lib/fileutils.rb:222:in `reverse_each'
from /home/username/ruby-2.1.1/lib/fileutils.rb:222:in `block in mkdir_p'
from /home/username/ruby-2.1.1/lib/fileutils.rb:208:in `each'
from /home/username/ruby-2.1.1/lib/fileutils.rb:208:in `mkdir_p'
from ./tool/rbinstall.rb:193:in `makedirs'
from ./tool/rbinstall.rb:300:in `prepare'
from ./tool/rbinstall.rb:339:in `block in <main>'
from ./tool/rbinstall.rb:789:in `call'
from ./tool/rbinstall.rb:789:in `block in <main>'
from ./tool/rbinstall.rb:786:in `each'
from ./tool/rbinstall.rb:786:in `<main>'
make: *** [do-install-all] Error 1
My service provider says it's the max level of access he can give me.
Tried installing it from CPANEL Ruby on rails installation. No luck from there either.
Any workarounds to install ruby, rvm and rails?
Thanks.
P.S. Tried a lot of methods posted online, no luck.

I get error message:in `tr': invalid byte sequence in UTF-8 (ArgumentError) when I run: ruby dk.rb init

I have installed Ruby 1.92 in my computer, and would like to intall rails.
When I run: gem install rails, I get error message as below:
*D:\Ruby192\Devkit>gem install rails
*ERROR: Error installing rails:
The 'json' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'**
Then I download DevKit 4.5.2 or DevKit 3.5 and try them both as:
D:\Ruby192\Devkit>ruby dk.rb init
I always get error message:
d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:175:in `tr': invalid byte sequence in UTF-8 (ArgumentError)
from d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:175:in `initialize'
from d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:233:in `exception'
from d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:233:in `raise'
from d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:233:in `check'
from d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:256:in `OpenKey'
from d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:387:in `open'
from d:/Ruby192/lib/ruby/1.9.1/win32/registry.rb:498:in `open'
from dk.rb:118:in `block in scan_for'
from dk.rb:116:in `each'
from dk.rb:116:in `scan_for'
from dk.rb:138:in `block in installed_rubies'
from dk.rb:138:in `collect'
from dk.rb:138:in `installed_rubies'
from dk.rb:146:in `init'
from dk.rb:313:in `run'
from dk.rb:332:in `<main>'
Have you guys got any suggestion on the problem?
I have encountered the same situation. I think that you may want to install json library. You should use msys.bat and install json on this terminal.
Execute msys.bat in a DevKit directory -> it invokes a new terminal.
gem install json on this terminal.
You can continue gem install rails.
The problem was solved for me by clearing the LANG environment variable first:
set LANG=
ruby dk.rb init
The idea comes from this question on the RubyInstaller Google Group.

Resources