Deploy error on AppCloud with ruby-debug19 in text, development environments - ruby-on-rails

In EY AppCloud, even when you run in development env, they run bundler --without development and test. My Gemfile contains this
group :test, :development do
gem 'ruby-debug19', :require => 'ruby-debug'
end
and when I deploy I get this error:
Successfully installed engineyard-serverside-1.4.2
1 gem installed
~> Deploying revision a01f92c migrating to new FactoryGirl
~> Pushing code to all servers
~> Starting full deploy
~> Copying to /data/eg/releases/20110821184344
~> Ensuring proper ownership
~> Gemfile detected, bundling gems
~> Symlinking configs
ln: creating symbolic link `/data/eg/releases/20110821184344/config/database.yml': File exists
~> Migrating: cd /data/eg/releases/20110821184344 && PATH=/data/eg/releases/20110821184344/ey_bundler_binstubs:$PATH RAILS_ENV=development RACK_ENV=development MERB_ENV=development rake db:migrate --trace
rake aborted!
no such file to load -- ruby-debug
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in `require'
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in `each'
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in `block in require'
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:55:in `each'
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:55:in `require'
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler.rb:120:in `require'
/data/eg/releases/20110821184344/config/application.rb:7:in `<top (required)>'
/data/eg/releases/20110821184344/Rakefile:5:in `require'
/data/eg/releases/20110821184344/Rakefile:5:in `<top (required)>'
/data/eg/shared/bundled_gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load'
/data/eg/shared/bundled_gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/data/eg/shared/bundled_gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:495:in `raw_load_rakefile'
/data/eg/shared/bundled_gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:78:in `block in load_rakefile'
/data/eg/shared/bundled_gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/data/eg/shared/bundled_gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:77:in `load_rakefile'
/data/eg/shared/bundled_gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:61:in `block in run'
/data/eg/shared/bundled_gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/data/eg/shared/bundled_gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/data/eg/shared/bundled_gems/ruby/1.9.1/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/data/eg/releases/20110821184344/ey_bundler_binstubs/rake:16:in `load'
/data/eg/releases/20110821184344/ey_bundler_binstubs/rake:16:in `<main>'
~> [Attention] Maintenance page still up, consider the following before removing:
* any deploy hooks ran, be careful if they were destructive
* any migrations ran, be careful if they were destructive
* your old code is still symlinked as current
Failed deployment recorded in AppCloud
Deploy failed
If I comment out the gem 'ruby-debug19' line in Gemfile it works. But it should be ignoring that anyway since as mentioned, AppCloud ignores test, development env gems. It works locally in both cases. Can anyone think at all what might cause this?

I believe this is because config/application.rb calls Bundler.require with a few group names, one being Rails.env. You RAILS_ENV on the command line is development, which means Bundler.require is trying to load the development group and require things in it, including ruby-debug. Since the bundle has been installed the development group, it breaks.
Probably best to use development for RAILS_ENV when running your app locally and either staging or production for your app on AppCloud.

AppCloud does not install the 'development' or 'test' groups by default. You would need to configure that in an eydeploy.rb file. You can find documentation about Installation Groups at http://docs.engineyard.com/bundler-tips-for-appcloud.html.

Related

"bundle-exec-jekyll-serve" causes LoadError

I am a novice programmer trying to use a Jekyll theme for my Github blog. This is my first time using it... and I'm having problems with bundle exec jekyll serve command.
(FYI, I'm using Windows OS.)
Here's the output:
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/html.rb:10:in `require': cannot load such file -- rexml/parsers/baseparser (LoadError)
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/html.rb:10:in `<top (required)>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/html.rb:10:in `require'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/html.rb:10:in `<top (required)>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/paragraph.rb:14:in `require'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown/paragraph.rb:14:in `<top (required)>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:345:in `require'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:345:in `<class:Kramdown>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:60:in `<module:Parser>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:19:in `<module:Kramdown>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/kramdown-1.17.0/lib/kramdown/parser/kramdown.rb:17:in `<top (required)>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.6/lib/jekyll/converters/smartypants.rb:3:in `require'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.6/lib/jekyll/converters/smartypants.rb:3:in `<top (required)>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.6/lib/jekyll.rb:13:in `require'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.6/lib/jekyll.rb:13:in `block in require_all'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.6/lib/jekyll.rb:12:in `each'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.6/lib/jekyll.rb:12:in `require_all'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.6/lib/jekyll.rb:194:in `<top (required)>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.6/exe/jekyll:8:in `require'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/jekyll-3.8.6/exe/jekyll:8:in `<top (required)>'
from C:/Ruby30-x64/bin/jekyll:25:in `load'
from C:/Ruby30-x64/bin/jekyll:25:in `<main>'
I tried these 4 different solutions:
1.
bundle add webrick
But had the same error
(referenced bundle exec jekyll serve: cannot load such file)
gem install jekyll github-pages
gem install jekyll
gem install jekyll-feed
bundle update
But had the same error
3.
gem install webrick
gem install jekyll -mentions
Then added
group :jekyll_plugins do
gem "jekyll-mentions", "1.6.0"
gem "webrick"
end
to my gemfile, then
bundle install
But had the same error
(referenced https://github.com/jekyll/jekyll/issues/8523)
bundle add sdbm
bundle add webrick
bundle add net-telnet
bundle add xmlrpc
But had the same error.
Is there any way I can fix this situation?
From what I understand, Ruby moves all stdlib parts into gems, some are "default gems", as in, they are normally installed with Ruby and don't need a reference in your Gemfile, but some are "bundled gems" which also are installed with Ruby, but need a reference in Gemfile. The problem stems from a fact, that with every Ruby release, some "default gems" become "bundled gems".
Such a situation happened with webrick in the past.
In your case it's most likely that you need rexml, which just became a "bundled gem" in Ruby 3.0: https://stdgems.org/rexml/
All this about a theory, but a solution is pretty simple. You just need to do
bundle add rexml
and then bundle install.

Rails app stopped running locally after pushing it to Heroku master

I pushed a (very simple) Rails app up to Heroku, the build was successful and it works online (minus some route issues), but now I can't get it to run locally. It's actually a clone of the "getting started" app I thought I'd modify to avoid deployment issues. When I try to start a Rails server I get the following message:
$ rails s
Looks like your app's ./bin/rails is a stub that was generated by Bundler.
In Rails 4, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.
Here's how to upgrade:
bundle config --delete bin # Turn off Bundler's stub generator
rake rails:update:bin # Use the new Rails 4 executables
git add bin # Add bin/ to source control
You may need to remove bin/ from your .gitignore as well.
When you install a gem whose executable you want to use in your app,
generate it and add it to source control:
bundle binstubs some-gem-name
git add bin/new-executable
Bundler::GemRequireError: There was an error while trying to load the gem 'uglifier'.
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
Backtrace for gem load error is:
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/execjs-2.7.0/lib/execjs.rb:4:in `<main>'
org/jruby/RubyKernel.java:961:in `require'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/uglifier-3.2.0/lib/uglifier.rb:1:in `<main>'
org/jruby/RubyKernel.java:961:in `require'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/uglifier-3.2.0/lib/uglifier.rb:5:in `block in (root)'
org/jruby/RubyArray.java:1734:in `each'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/bundler-1.15.3/lib/bundler/runtime.rb:1:in `block in (root)'
org/jruby/RubyArray.java:1734:in `each'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/bundler-1.15.3/lib/bundler/runtime.rb:82:in `require'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/bundler-1.15.3/lib/bundler/runtime.rb:77:in `require'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/bundler-1.15.3/lib/bundler/runtime.rb:66:in `<main>'
org/jruby/RubyKernel.java:961:in `require'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/bundler-1.15.3/lib/bundler.rb:108:in `block in require'
org/jruby/RubyKernel.java:1747:in `tap'
C:/blog/config/application.rb:7:in `(root)'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:1:in `(root)'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:78:in `<main>'
org/jruby/RubyKernel.java:961:in `require'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `block in server'
org/jruby/RubyKernel.java:1298:in `loop'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<main>'
org/jruby/RubyKernel.java:961:in `require'
C:/jruby-9.1.12.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/railties-4.2.4/lib/rails/app_rails_loader.rb:1:in `<main>'
org/jruby/RubyKernel.java:979:in `load'
C:/jruby-9.1.12.0/bin/rails:22:in `<main>'
Bundler Error Backtrace:
block in require at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/bundler-1.15.3/lib/bundler/runtime.rb:85
each at org/jruby/RubyArray.java:1734
block in require at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/bundler-1.15.3/lib/bundler/runtime.rb:77
each at org/jruby/RubyArray.java:1734
require at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/bundler-1.15.3/lib/bundler/runtime.rb:66
require at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/bundler-1.15.3/lib/bundler.rb:108
<main> at C:/blog/config/application.rb:7
require at org/jruby/RubyKernel.java:961
block in (root) at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:1
tap at org/jruby/RubyKernel.java:1747
server at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:78
server at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75
<main> at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39
require at org/jruby/RubyKernel.java:961
block in (root) at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/railties-4.2.4/lib/rails/commands.rb:17
loop at org/jruby/RubyKernel.java:1298
(root) at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/railties-4.2.4/lib/rails/app_rails_loader.rb:1
<main> at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/railties-4.2.4/lib/rails/app_rails_loader.rb:45
require at org/jruby/RubyKernel.java:961
require at C:/jruby-9.1.12.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
<main> at C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/railties-4.2.4/lib/rails/app_rails_loader.rb:34
load at org/jruby/RubyKernel.java:979
<main> at C:/jruby-9.1.12.0/bin/rails:22
Removing uglifier and coffee-rails gets the app up and running locally so, I tried that and followed the upgrade instructions, then used bundle install to add them again, with the same result. I also can't push a version of this app up to Heroku without those gems so I'm left scratching my head where to go from here.
Here is a copy of the app I pushed to Git (excuse the language on one of the commits I was quite frustrated) to help with trouble shooting
https://github.com/taswelldavis/blog
Thanks for the help,
Anna

How do I run specs for the activeadmin gem

I am trying to run the specs for a local clone of the activeadmin gems current master.
I am using ruby 2.2.2 and have bundled successfully.
When I try to run one of the specs like so:
bundle exec rspec spec/unit/filters/humanized_spec.rb
I am getting the following error:
The git source https://github.com/jruby/activerecord-jdbc-adapter is not yet checked out. Please run `bundle install` before trying to start your application
Coverage report generated for RSpec to /Users/aljoscha/gem/activeadmin/coverage. 0.0 / 0.0 LOC (100.0%) covered.
/Users/aljoscha/gem/activeadmin/spec/rails_helper.rb:13:in `require': cannot load such file -- active_record (LoadError)
from /Users/aljoscha/gem/activeadmin/spec/rails_helper.rb:13:in `<top (required)>'
from /Users/aljoscha/gem/activeadmin/spec/unit/filters/humanized_spec.rb:1:in `require'
from /Users/aljoscha/gem/activeadmin/spec/unit/filters/humanized_spec.rb:1:in `<top (required)>'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `load'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `block in load_spec_files'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `each'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `load_spec_files'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:100:in `setup'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:86:in `run'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:71:in `run'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/exe/rspec:4:in `<top (required)>'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/rspec:22:in `load'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/rspec:22:in `<main>'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'
which I cannot make sense of.
Especially since activerecord-jdbc-adapter is not even in the Gemfile.
What am I missing?
Try prepending your command with bundle exec:
bundle exec rspec spec/unit/filters/humanized_spec.rb
It looks like you have a local version discrepancy causing issues.
If not, did you follow all of the steps listed on their contributing readme?
If you are still stuck, you may be experiencing an issue with bundler itself. First, try updating bundler then reinstalling gems and attempt to run rspec. If that doesn't work you may need to delete the bundle cache folder and start over.
I'm going to re-answer to emphasize how to test a gem using appraisal as mentioned in CONTIBUTING:
bundle exec appraisal install
bundle exec appraisal rails_50 rspec spec/unit/filters/humanized_spec.rb
Thank you for your interest in Active Admin.

Rails console in production: NameError: uninitialized constant

I have a rails app (rails 5). In development, everything work, when i use
rails console
And enter an instruction, for example User.all , it's working.
In production, my app work perfectly, no problems, no errors, but when i use rails console production and enter for example User.all i have an error :
NameError: uninitialized constant User
from (irb):2
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /home/alexandre/tcheen/bin/rails:9:in `<top (required)>'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `load'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `call'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/command_wrapper.rb:38:in `call'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/application.rb:191:in `block in serve'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/application.rb:161:in `fork'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/application.rb:161:in `serve'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/alexandre/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
I have the same problem with all my classes, but i repeat, the application work perfectly.
I develop on Mac OS and the app run in production on debian 8.
My models are correctly named i verified.
Thanks
I had this problem and realized it happened after I made a tweak to one of my job files.
What fixed it was restarting the spring loader. Just run
spring stop
Then the next time you run the rails console it should load things as normal.
I had this same issue, rewolf's answer above solved it for me temporarily.
Just to add to his answer:
After stopping the spring gem by running the command below
spring stop
You can also fix this issue permanently by upspringing (removing the spring gem from) your bin/ executables:
bin/spring binstub --remove --all
Or
spring binstub --remove --all
You can now run the command below to get into rails console in production
rails c --environment=production
Also, to avoid this from occurring in subsequent occasions endeavour to make sure that the spring gem is only present in development and test groups in your Gemfile.
Moreso, when you're in production make sure you always provide the --without development test argument to the bundle install command
bundle install --without development test
and not the usual or common
bundle install
Please note: As an indication, whenever you run the command rails c or rails console and you see the output below:
Running via Spring preloader in process 26651
WARNING: Spring is running in production. To fix this make sure the spring gem is only present in development and test groups in your Gemfile and make sure you always use bundle install --without development test in production
It's an indication that the spring gem is running in your production environment, and it should be stopped or removed entirely from your bin executables.
That's all.
I hope this helps

Secret generation in redmine installation fails with error in mysql2/mysql2

I am trying to install redmine 2.3.x on my Debian vServer. I already managed to build ruby from source and installed gems, rails and the apache passenger module. It should work until that point. I used the turotial at domainfactory: http://www.df.eu/de/service/df-faq/cloudserver/anleitungen/ruby-on-rails-installieren-debian-ubuntu/ .
After that I downloaded and extracted the redmine application as described here: http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Installation-procedure. I created a mysql account and database, made a copy of the config/database.yml.example -> config/database.yml and filled in the correct values.
After that I installed bundler with
gem install bundler
And did go on with preparing the environment:
bundle install --without development test
All these commands did succeed.
After that I wanted to generate the secret token with the fallowing command:
rake generate_secret_token
The execution was interrupted with the fallowing message:
# rake generate_secret_token --trace
rake aborted!
cannot load such file -- mysql2/mysql2
/usr/local/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `require'
/usr/local/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `<top (required)>'
/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
/usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
/var/www/potato/config/application.rb:7:in `<top (required)>'
/usr/local/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:36:in `require'
/usr/local/lib/ruby/site_ruby/2.0.0/rubygems/custom_require.rb:36:in `require'
/var/www/potato/Rakefile:5:in `<top (required)>'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:637:in `raw_load_rakefile'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:94:in `block in load_rakefile'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:93:in `load_rakefile'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:77:in `block in run'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
I was trying to resolve this by checking versions and installed gems.
Ruby: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
Rails: Rails 3.2.13
Gems: 1.8.25
Redmine: 2.3.3
I verified with gem list --local that the gem "mysql2" is installed.
gem "mysql": mysql2 (0.3.13)
As the problem seems to rely on this, I tried reinstalling the package, but this did not help.
What did I wrong here?
Thanks in advance,
Sebastian Büttner
I found this error happens if you don't have the following package installed in your system (at least on Debian 9). So run command:
apt-get install default-libmysqlclient-dev
try bundle exec rake generate_secret_token
(if #1 does not help) Check if mysql2 is presented in output list for bundle list (it is different with gem list!). Be careful that redmine install DB adapter according to your settings in database.yml (but I think you install it correctly)
Please, check if you have necessary VC runtime installed. Please, check the VC runtime dll version, your mysql vendor dll is dependent upon.

Resources