The other night I took a stab at getting Hudson up and running on an EC2 instance. Everything was running fine and dandy until this morning when I created an AMI based on what I had created. Doing that also created a snapshot of my drive.
After that I realized that my Jenkins server wasn't running. Sure enough, looking at my ssh instance, I had been disconnected. So I logged back in and tried to start things up by running Jenkins server and this is what I got for an error:
/home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1064:in `escape': can't convert Pathname to String (TypeError)
from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1064:in `block in loaded_path?'
from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1063:in `each'
from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1063:in `find'
from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1063:in `loaded_path?'
from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p180/gems/httparty-0.6.1/lib/httparty.rb:10:in `<top (required)>'
from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p180/gems/jenkins-0.6.2/lib/jenkins/api.rb:1:in `<top (required)>'
from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p180/gems/jenkins-0.6.2/lib/jenkins.rb:3:in `<module:Jenkins>'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p180/gems/jenkins-0.6.2/lib/jenkins.rb:1:in `<top (required)>'
from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
from /home/ubuntu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p180/gems/jenkins-0.6.2/bin/jenkins:4:in `<top (required)>'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p180/bin/jenkins:19:in `load'
from /home/ubuntu/.rvm/gems/ruby-1.9.2-p180/bin/jenkins:19:in `<main>'
I did use a walkthrough to get this setup, and have referenced back to it to see if missed something, but it's pretty straight forward. I've googled for the can't convert Pathname to String with no luck as well. I honestly have no clue where to even start looking into this one. Is it a Ruby issue? Rails? Jenkins?
I'll update this if i find any other useful info.
EDIT
I should also add that I did go into the workspace of the project that I had Jenkins building and was able to start it up just fine. Because of that I don't think this is a Ruby issue.
EDIT 2
Ok, so I decided to take EC2 out of the equation and brought up my own server with Ubuntu 10.10. Same setup, everything worked great, then I rebooted, and now I get this error again. Now I'm confident it's a simple silly mistake due to me being a relative Ubuntu newb, but I'm sure someone else has ran into this before.
For a quick fix, try downgrading rubygems to less than 1.6.
Looks like the rubygems devs introduced some code to avoid loading a file more than once.
If you're interested, here's the offending code (from https://github.com/rubygems/rubygems.git at rev dcfba4e1de4c7388425eb5de5066cb5aa9bea6e6):
def self.loaded_path? path
# TODO: ruby needs a feature to let us query what's loaded in 1.8 and 1.9
$LOADED_FEATURES.find { |s|
s =~ /(^|\/)#{Regexp.escape path}#{Regexp.union(*Gem.suffixes)}$/
}
end
If you're unable to downgrade, a less ideal solution is to edit rubygems.rb so
Regexp.escape path
becomes
Regexp.escape path.to_s
Long story short, the solution was to install Jenkins as apt-get instead of using the Gem. It appears that it came down to an issue where Jenkins was looking at the wrong version of Ruby.
This URL is what ultimately got me started down the path to fix this: http://www.ygamretuta.com/2011/03/ruby-installing-ramaze-working-around-cant-convert-pathname-to-string-error/
I should also add that although the answers that Kelvin gave may have gotten me around the error, neither were ideal solutions to the problem.
Related
I am trying t configure the Salesforce Vulnreport tool, and everytime I run the SEED.rb I get the following error:
Setting up the PostgreSQL database...
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- dm--adapter (LoadError)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/vendor_ruby/dm-core/adapters.rb:163:in `load_adapter'
from /usr/lib/ruby/vendor_ruby/dm-core/adapters.rb:133:in `adapter_class'
from /usr/lib/ruby/vendor_ruby/dm-core/adapters.rb:13:in `new'
from /usr/lib/ruby/vendor_ruby/dm-core.rb:230:in `setup'
from /root/Documents/Resources/Applications/vulnreport/models/init.rb:19:in `<top (required)>'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from ./SEED.rb:20:in `<main>'
I have checked the Gemfile and 'dm-postgres-adapter' is included and installed. I have no idea why I am getting this error, and though I found others attempting to install this with the same issue, I found no fixes. I am not proficient enough with Ruby to really know where to go from here. Any help would be appreciated. Also I hope this I posted this in an OK place.
Thanks!
I realized while looking through my repo that my .env file had a small error in the 'export DATABASE_URL' component which was causing the issue. I was able to fix it by adjusting the incorrect password I had (1 character was off). However, the error message is not very clear. I feel it could have more easily pointed to an authentication failure to the database being the issue.
Recently came back to a computer (Mac OS X Lion 10.7) with which I've had repeated environment issues, started a new rails app, and ran
rake db:create
I got this error output (with --trace):
rake aborted!
dlopen(/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg_ext.bundle, 9): Library not loaded: /usr/lib/libpq.5.dylib
Referenced from: /Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg_ext.bundle
Reason: image not found - /Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg_ext.bundle
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg.rb:4:in `require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg.rb:4:in `<top (required)>'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
/Users/<username>/rails/<appname>/config/application.rb:7:in `<top (required)>'
/Users/<username>/rails/<appname>/Rakefile:4:in `require'
/Users/<username>/rails/<appname>/Rakefile:4:in `<top (required)>'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/application.rb:637:in `raw_load_rakefile'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/application.rb:94:in `block in load_rakefile'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/application.rb:93:in `load_rakefile'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/application.rb:77:in `block in run'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
bin/rake:4:in `<main>'
config/application.rb:7 refers to:
Bundler.require(:default, Rails.env)
This comes on the heals of a couple environment issues that are, I'm sure, causing the issue, but I don't know how. Basically, I was having issues with homebrew (brew install wget wouldn't work, complaining it was already downloaded, but then saying:
checking for libssl... no
configure: error: --with-ssl=openssl was given, but SSL is not available
So I uninstalled homebrew, uninstalled my shell (fish shell), reinstalled both, and tried to start things from scratch. Probably not a great idea, in retrospect. I seem to have messed things up worse than they already were.
brew doctor seems to think most things are OK, though. The only thing that jumps out at me as possibly related is:
/Users/sasha/.rvm/bin/pkg-config
(There's another thing brought up -- "/usr/bin occurs before /usr/local/bin", but this only applies to the node, npm, and gcov-4.2 installs, which don't seem relevant to this Rails issue.)
And I think RVM is supposed to have its own pkg-config install, right?
At any rate, OpenSSL is installed and updated by homebrew, and looking good (it shows up in brew list). Also, my XCode Command Line Tools is up to date as well.
I guess my question is if anyone has any idea what's going on? I've tried reordering my path to comply with brew doctor, un/reinstalling lots of things, updating everything, etc, and this just won't go away. Super frustrating, cause I basically can't do anything without rake working. And I think this dylib and openssl issue might be interrelated, so I figured I'd just dump all this data here.
Any ideas? I'd really appreciate help.
Thanks!
EDIT -- This is using Rails 4.0, with the pg gem.
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0.rc1'
# Use postgresql as the database for Active Record
gem 'pg'
if that makes any difference.
UPDATE -- Seems to be related to this problem, which I'm also having. I think rake is not working because of pg, which isn't working because of crpyto/openssl.
The problem was based on an inexplicably empty libssl.dylib file. There was a backup (libssl.dylib.BAK), and I just overwrote the empty file with it and -- poof -- all the problems went away. No idea how that happened in the first place, but if anyone's having similar problems, I'd look for .BAK files in usr/lib/ and (if there are any) see if the associated files are empty.
I'm a newb to rails, so please excuse this question but I've been searching everywhere for how to do it. I have a github project I cloaned that I'm going to have to eventually work on, but need to view it now in the browser (will be crash coursing to get up to speed the next couple months). I've downloaded the directory and ran bundle install. Now I'm trying to start the rails server and I get this:
Chriss-MacBook-Pro:chris cgood$ rails server
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.11/lib/rails/railtie/configuration.rb:85:in `method_missing': undefined method `active_record' for #<Rails::Application::Configuration:0x007fc07b649c48> (NoMethodError)
from /Users/cgood/event/chris/config/application.rb:69:in `<class:Application>'
from /Users/cgood/event/chris/config/application.rb:25:in `<module:ChrisGood>'
from /Users/cgood/event/chris/config/application.rb:24:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.11/lib/rails/commands.rb:53:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.11/lib/rails/commands.rb:53:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.11/lib/rails/commands.rb:50:in `tap'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.11/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Any help would be really appreciated! I've been pulling out hair for hours tackling error message after error message. This one has me stuck as hard to find anything on the internet about it.
I have xcode, rails installer, homebrew and postgreSQL installed. Thanks.
2 things:
upgrade rails!! there's a post about the dangers of using 3.2.11
your app needs a file called database.yml, read this and this to find out what to put in it
Normally your app would have that file in it already, but since it usually contains sensitive data, like database user passwords, people tend to leave it out of their github repos. So you just need to make your own one.
Ok guys the truth is I'm working on porting an application up to justhost.com as I cant afford my own servers yet. Either way I have been receiving this error in the mongrel.log and am getting no help as to what this error means or how to fix it.
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in require': no such file to load -- dispatcher (LoadError)
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:inrequire'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:innew_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:inrequire'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:148:in rails'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:113:incloaker_'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in call'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:inlistener'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:in cloaker_'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:incall'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in initialize'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:innew'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in run'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:inrun'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
from /usr/bin/mongrel_rails:19:in `load'
from /usr/bin/mongrel_rails:19
I don't think this is anything dealing with the setup of my application, but I'm also a bit of a newb to Rails. If anyone knows how to fix this or what I may have done wrong, I'd appreciate it. Thanks in advance!
I did some looking into this one. As JustHost uses cPanel it turns out that cPanel currently does not support Rails 3.
I don't know if you're still interested in an answer but I had the same error when I was trying to start mongrel with the command mongrel_rails start in my rails3 app.
But it worked when I started it with rails server in the script folder of your app. If the mongrel gem is in your Gemfile, running rails server will start Mongrel and not WEBrick.
You'll find more information here.
Hope this helps !
Johan
I'm trying to generate model diagrams using the railroad gem. I have managed to generate a diagram for a different app, but I'm trying to get my head around some "legacy" code, and keep running into problems.
I know very little about ruby or rails, so any help would be appreciated...
Basically, I run:
$ railroad -v -M
and get:
Loading application environment
Loading application classes
./config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/string/access.rb:43:in `first': undefined method `[]' for #<Enumerable::Enumerator:0xb70a72d0> (NoMethodError)
from ./config/../vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:70:in `has_attachment'
from ./app/models/asset.rb:5
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ./config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:495:in `require'
from ./config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in'
from ./config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:495:in `require'
from /home/myname/.gem/ruby/1.8/gems/railroad-0.5.0/lib/railroad/models_diagram.rb:40:in `load_classes'
from /home/myname/.gem/ruby/1.8/gems/railroad-0.5.0/lib/railroad/models_diagram.rb:40:in `each'
from /home/myname/.gem/ruby/1.8/gems/railroad-0.5.0/lib/railroad/models_diagram.rb:40:in `load_classes'
from /home/myname/.gem/ruby/1.8/gems/railroad-0.5.0/lib/railroad/app_diagram.rb:21:in `initialize'
from /home/myname/.gem/ruby/1.8/gems/railroad-0.5.0/lib/railroad/models_diagram.rb:14:in `initialize'
from /home/myname/.gem/ruby/1.8/gems/railroad-0.5.0/bin/railroad:36:in `new'
from /home/myname/.gem/ruby/1.8/gems/railroad-0.5.0/bin/railroad:36
from /home/myname/.gem/ruby/1.8/bin/railroad:19:in `load'
from /home/myname/.gem/ruby/1.8/bin/railroad:19
I've tried reinstalling attachment_fu (it was already in the vendor/plugins folder) but that didn't seem to help.
I wouldn't be surprised if there was a problem with the schema - I've already had to fix typos in column names, missing references, that kind of thing. Is there anyway I can work out where it might be dying?
Thanks a lot!
Your version of Ruby, probably 1.8.7 or even more recent, is too modern for attachment_fu. To fix this, you need to change attachment_fu itself. Edit the file vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb and on line 66 change:
options[:path_prefix].first == '/'
(at the end) to
options[:path_prefix].starts_with? == '/'
Alternatives are to downgrade your version of Ruby to 1.8.6 (probably, perhaps even lower) or use a different plugin. Attachment_fu is not supported any longer. Paperclip is used these days.
This error is described in more detail here.