Changing where passenger looks for RubyGems - macos

I've installed the Passenger Preference Pane on OSX but whenever I try to run an app I get a 500 Internal Error. Looking at the log gives me the following error:
/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/utils.rb:25:in `require': no such file to load -- rubygems (LoadError)
from /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/utils.rb:25
from /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/bin/passenger-spawn-server:53:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/bin/passenger-spawn-server:53
[ pid=403 file=ext/apache2/Hooks.cpp:725 time=2009-11-15 23:33:38.110 ]:
Unexpected error in mod_passenger: Cannot spawn application '/Users/waynemolina/Projects/sandbox/rack-hello-world': The spawn server has exited unexpectedly.
Backtrace:
in 'virtual boost::shared_ptr Passenger::ApplicationPoolServer::Client::get(const Passenger::PoolOptions&)' (ApplicationPoolServer.h:471)
in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:521)
Since rubygems works everywhere else, I can only assume this error is because Passenger is looking in the wrong place for Rubygems. I installed Rubygems manually and it's located in /usr/local/bin/gem according to which gem. However, whereis gem returns /usr/bin/gem instead. I'm more than a little confused on what steps I need to take to fix this short of just reinstalling OSX and upgrading the built-in RubyGems install instead of installing it myself.

Related

Solargraph not working in Visual Studio Code

I have the following error in my VS Code:
[Error - 3:51:12 PM] Starting client failed
/usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': can't find gem solargraph (>= 0.a) with executable solargraph (Gem::GemNotFoundException)
from /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
from /usr/local/bin/solargraph:23:in `<main>'
I currently use rbenv and have as global and only Ruby version 2.6.3
What seems to be the problem here? why do I see a ruby/2.6.0/ above if the version is 2.6.3?
Thanks for the help!
If all else fails, you can try setting solargraph.commandPath to the executable's absolute path. Running which solargraph should give you the path to use.
I found the solution you should gem install solargraph. If not work and get this error
ERROR: Loading command: install (ArgumentError)
unknown encoding name - CP720
ERROR: While executing gem ... (NoMethodError)
undefined method "invoke_with_build_args" for nil:NilClass
Try to execute by administrator in CMD
chcp 1252
Then try to install gem again
Enjoy!
Try executing
solargraph -v
from the VS Code terminal.
If that gives an error try
gem install bundler:1.17.3
I was getting errors with every keystroke similar to:
[Error - 6:08:49 PM] Request textDocument/completion failed.
Message: [ArgumentError] wrong number of arguments (given 1, expected 0)
Code: -32603
I'm using VSCodium, I changed a configuration in order to install "official" extensions. I re-installed all extensions, including Solargraph, that's when this started happening.
In the end, restarting editor via Developer: Reload Window fixed it.

Problems running rails 2.3.10 bundler `require': no such file to load -- rubygems (LoadError)

I have an app on Rails 2.3.10 on production; when I try to start with ruby script/server -p 3017 -e production -d it throws me the following error:
Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org
try installing passenger to start the project with but it generates another error:
/home/gmcms/.rvm/gems/ruby-1.8.7-p370#nick_backend/gems/bundler-1.3.5/lib/bundler/shared_helpers.rb:2:in `require': no such file to load -- rubygems (LoadError)
from /home/gmcms/.rvm/gems/ruby-1.8.7-p370#nick_backend/gems/bundler-1.3.5/lib/bundler/shared_helpers.rb:2
from /home/gmcms/.rvm/gems/ruby-1.8.7-p370#nick_backend/gems/bundler-1.3.5/lib/bundler/setup.rb:1:in `require'
from /home/gmcms/.rvm/gems/ruby-1.8.7-p370#nick_backend/gems/bundler-1.3.5/lib/bundler/setup.rb:1
I got this project from another developer, and he always started the project this way; before it didn't have a Gemfile, so I created a Gemfile where I defined the gems the project is using and then install everything with bundler adding the parameter --deployment:
bundle install --deployment
I've also followed the steps that are on the official website of bundler:
http://bundler.io/v1.3/rails23.html
But when I try to run the project the same way using ruby script/server it haves me the same error. I followed this threads but none of them worked for me:
http://docs.rubygems.org/read/chapter/15#page66
Rails "no such file to load -- rubygems (LoadError)"
no such file to load -- rubygems (LoadError)
What can I do? Thanks in advance.
Juan Trejo.
I have run into similar issues. Try running
rvm gemset use global && bundle

Including gems in ubuntu 11.04

I've got a problem with running an additional gem under ubuntu 11.04. I installed spiceweasel via gem install - which put it in /var/lib/gems/1.8/gems/spiceweasel. When I try to run it, I get:
`require': no such file to load -- spiceweasel/version (LoadError)
The file is in /var/lib/gems/1.8/gems/spiceweasel-0.7.1/lib/spiceweasel/version.rb but cannot be loaded. This happens both with and without -rubygems.
How do I fix this?
It seems to be the same problem like here: Ruby: require 'irbtools' raises LoadError
The gem author published the gem with wrong permissions. You should contact the gem author.

Trying to run mongo3 gem on Ubuntu 10.10. Help!

I'm trying to run the ruby gem "mongo3" (http://mongo3.com/)
I'm new to gem, but I would think that running "gem mongo3" should execute it, but I get this error:
chris#Zombie:~$ gem mongo3
ERROR: While executing gem ... (RuntimeError)
Unknown command mongo3
So I did "gem which mongo3" and it said it is located at "/var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb". I then ran "ruby /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb" with the following result:
chris#Zombie:~$ ruby /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb
/var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3/node.rb:1:in `require': no such file to load -- json (LoadError)
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3/node.rb:1
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:41:in `require'
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:41:in `require_all_libs_relative_to'
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:41:in `each'
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:41:in `require_all_libs_relative_to'
from /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb:53
I'm not sure what I'm doing wrong - I suspect that ruby and gems are confused about where the gems should be loaded from or something. Thanks!
You don't need to do a gem mongo3 or ruby /var/lib/gems/1.8/gems/mongo3-0.1.3/lib/mongo3.rb. Instead, just simply run mongo3.
Make sure to follow the usage instructions here to configure it or you'll get runtime errors.
Edit: If you don't install the gem using sudo, then you won't have proper write access to /usr/bin, meaning the mongo3 executable will not be in your path. You'll probably see a warning like this when installing:
WARNING: Installing to ~/.gem since /var/lib/gems/1.8 and
/usr/bin aren't both writable.
WARNING: You don't have /home/chris/.gem/ruby/1.8/bin in your PATH,
gem executables will not run.
You have two options: install the gem using sudo gem install mongo3 so it properly links to /usr/bin, or add /home/chris/.gem/ruby/1.8/bin to your path.

Rake failing to start

I'm having trouble understanding the following error with Ruby's Rake.
C:\>gem install rake
Successfully installed rake-0.8.7
1 gem installed
Installing ri documentation for rake-0.8.7...
Installing RDoc documentation for rake-0.8.7...
C:\>rake
C:/Ruby192/lib/ruby/1.9.1/rubygems.rb:340:in `bin_path': can't find executable r
ake for rake-0.8.7 (Gem::Exception)
from C:/Ruby192/bin/rake:19:in `<main>'
Running Ruby 1.9.2 for Windows.
Edit: Installing from source yields:
C:\Documents and Settings\XPherior\Desktop\rake-0.8.7\rake-0.8.7>ruby install.rb
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load --
ftools (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from install.rb:3:in `<main>'
The second error, where you have installed into C:\Documenets And Settings\ is occurring because you cannot install ruby into a folder with a space in the path. It should be installed into c:\Ruby\ c:\Ruby#.#.#\ if you want the version # in the path, or something along those lines.
for the first error: there is a bug in the rubyinstaller.org version of ruby 1.9.2, which is causing this by running "gem install rake".
you can read about the error you're getting, here: http://redmine.ruby-lang.org/issues/show/3677
there are a couple of ways to fix this error:
re-install ruby v1.9.2 and don't run "gem install rake". rake v0.8.7 is built into the ruby v1.9.2 installation, so you don't need to re-install it.
if you do want to manually install it, you can delete the ruby.gempspec file from your ruby installation. this file is located at (rubyinstalldir)\lib\ruby\gems\1.9.1\specifications
either of these options will fix the problem for you.
i'm not sure which is "better" off-hand... it may be necessary to delete the gemspec file and reinstall rake, to support updates and new versions in the future. i'm not sure, though. we'll find out once rake is updated and we need to install a new version. or, perhaps, the issue will be fixed in the ruby installation by then, and we'll just need to update our ruby install.
I've run into your both errors.
For the first one. Try the solution post at here http://betterlogic.com/roger/2010/11/ruby-1-9-2-rake-woe/.
And for the second error, it's causes by a library update by the ruby 1.9. From the Programming Ruby 1.9, "ftools have been removed (and replaced by fileutils)." I'm not pretty sure but at least that's an explanation.

Resources