I have inherited a rails 2.3.2 application and got it to work using ruby 1.8.7 under rbenv including some old versions of other gems and software.
Now I have generated a Gemfile and try to verify it by runing any bundle comand on it, e.g. bundle check, install, etc. but any of these operations fail. I installed the rbenv bundler plugin which makes it look a little lesss severe but I still can't figure it out.
$ bundle -V
/usr/local/lib/site_ruby/1.9.1/rubygems.rb:846: Use RbConfig instead of obsolete and deprecated Config.
/usr/lib/ruby/vendor_ruby/bundler/rubygems_integration.rb:310:in `<module:Bundler>': uninitialized constant Gem::VERSION (NameError)
from /usr/lib/ruby/vendor_ruby/bundler/rubygems_integration.rb:1:in `<top (required)>'
from /usr/lib/ruby/vendor_ruby/bundler.rb:12:in `require'
from /usr/lib/ruby/vendor_ruby/bundler.rb:12:in `<top (required)>'
from /usr/bin/bundle:4:in `require'
from /usr/bin/bundle:4:in `<main>'
My bundler installation:
$ which bundle
/usr/bin/bundle
Ruby:
$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
Rbenv gives me problems too now:
$ rbenv alternatives
Skipping 1.8.7-debian, it already exists
/usr/local/lib/site_ruby/1.9.1/rubygems.rb:846: Use RbConfig instead of obsolete and deprecated Config.
Skipping 1.9.3-debian, it already exists
Isn't there supposed to be a shim for bundler? It seems that bundler is called directly.
I am lost. If anyone could help me with this I would be glad.
p.s.: I also just discovered this:
$ rbenv rehash
/usr/local/lib/site_ruby/1.9.1/rubygems.rb:846: Use RbConfig instead of obsolete and deprecated Config.
/usr/lib/ruby/vendor_ruby/bundler/rubygems_integration.rb:310:in `<module:Bundler>': uninitialized constant Gem::VERSION (NameError)
from /usr/lib/ruby/vendor_ruby/bundler/rubygems_integration.rb:1:in `<top (required)>'
from /usr/lib/ruby/vendor_ruby/bundler.rb:12:in `require'
from /usr/lib/ruby/vendor_ruby/bundler.rb:12:in `<top (required)>'
from /home/bernhard/.rbenv/plugins/bundler/etc/rbenv.d/bundler/rehash.rb:361:in `require'
from /home/bernhard/.rbenv/plugins/bundler/etc/rbenv.d/bundler/rehash.rb:361:in `require_and_patch_bundler'
from /home/bernhard/.rbenv/plugins/bundler/etc/rbenv.d/bundler/rehash.rb:427:in `<main>'
cat: /home/bernhard/.rbenv/plugins/bundler/share/rbenv/bundler/manifest.txt: No such file or directory
Related
I have been trying to fix my project using Ruby 2.3.8, I am using rvm to install Ruby 2.3.8 but need extra works to install that on my mac because 2.3.8 need can't resolve with openssl 1.1. So I need to find how to install openssl 1.0 because Homebrew deleted the openssl 1.0 so it needs extra research to fix that.
In my project I am using MySQL 5.7 and to install MySQL 5.7 I need to install OpenSSL 1.1 again, so it automatically installs OpenSSL 1.1
When I go to my project and doing rake db:create I got error like this:
rake aborted!
LoadError: library not found for class Digest::SHA1 -- digest/sha1
/Users/hoomacbuk/Documents/mekari/quickbook/config/boot.rb:4:in `<top (required)>'
/Users/hoomacbuk/Documents/mekari/quickbook/config/application.rb:1:in `<top (required)>'
/Users/hoomacbuk/Documents/mekari/quickbook/Rakefile:4:in `<top (required)>'
/Users/hoomacbuk/.rvm/gems/ruby-2.3.8/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
Caused by:
LoadError: dlopen(/Users/hoomacbuk/.rvm/rubies/ruby-2.3.8/lib/ruby/2.3.0/x86_64-darwin18/digest/sha1.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
Referenced from: /Users/hoomacbuk/.rvm/rubies/ruby-2.3.8/lib/ruby/2.3.0/x86_64-darwin18/digest/sha1.bundle
Reason: image not found - /Users/hoomacbuk/.rvm/rubies/ruby-2.3.8/lib/ruby/2.3.0/x86_64-darwin18/digest/sha1.bundle
/Users/hoomacbuk/Documents/mekari/quickbook/config/boot.rb:4:in `<top (required)>'
/Users/hoomacbuk/Documents/mekari/quickbook/config/application.rb:1:in `<top (required)>'
/Users/hoomacbuk/Documents/mekari/quickbook/Rakefile:4:in `<top (required)>'
/Users/hoomacbuk/.rvm/gems/ruby-2.3.8/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
And when I running bin/rake db:create I got this error again :
/Users/hoomacbuk/.rvm/rubies/ruby-2.3.8/lib/ruby/2.3.0/digest.rb:16:in `const_missing': library not found for class Digest::SHA1 -- digest/sha1 (LoadError)
How can I get Ruby 2.3.x to run? I
There seems to be an issue with your ruby version.
Uninstall the current version and reinstall the same one and then try again.
rvm uninstall 2.3.8
and then
rvm install 2.3.8
Its weird with CentOS release 6.7 (Final) that unable to run console on stage.
Ruby-version => 2.0.0
Rails- version => 4.1
Once I do bin/rails c staging
/var/www/rails/Ixentech/releases/20151201150901/config/application.rb:7:in `<top (required)>': uninitialized constant Bundler (NameError)
from /home/carmatec/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /home/carmatec/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /home/carmatec/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:141:in `require_application_and_environment!'
from /home/carmatec/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:67:in `console'
from /home/carmatec/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/carmatec/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
from /home/carmatec/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `require'
from /home/carmatec/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
from /home/carmatec/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from bin/rails:4:in `<main>'
as I completely check with
uninitialized-constant-bundler-nameerror
nameerror-uninitialized-constant-bundler
bin dir permission
and
constant-bundler-namee
but no luck !!!
These answer work with ubuntu 12.04 LTS but not with CentOS
release 6.7 (Final) Further, I checked Redmine as well.
Any help would be appreciate !!!
Try gem install bundler from the command line. Then you'll also want to bundle install from the project directory.
It looks like your system doesn't have "bundler" installed on it yet. Bundler is a dependency manager, once it's installed the bundle install command will install any other gems needed by your project (such as rails itself!).
Did you copy this project directory over from another computer, or git clone it there or something? Cause you'd need bundler installed to create a Rails app in the first place, normally.
Bundler isn't actually included with a ruby install, but you need it as the first thing for Rails, and much other modern ruby code. After installing ruby on a new machine (or starting fresh on a new machine that has ruby pre-installed) gem install bundler should always be the next step.
I have a problem.
When I'm trying to generate something via rails g/rails generate controller/model/etc I got this message as an output in my terminal.
What I am doing wrong?
user#vps:/var/www/dap$ rails -v
Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.
Rails 4.2.0
user#vps:/var/www/dap$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
user#vps:/var/www/dap$ ruby script/generate controller StaticPages home help about ruby: No such file or directory -- script/generate (LoadError)
user#vps:/var/www/dap$ bin/rails generate controller StaticPages home help about
Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.
^C/var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/run.rb:99:in `gets': Interrupt
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/run.rb:99:in `verify_server_version'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/run.rb:56:in `run'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/run.rb:37:in `warm_run'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/run.rb:26:in `call'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/command.rb:7:in `call'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/rails.rb:23:in `call'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/command.rb:7:in `call'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client.rb:26:in `run'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/bin/spring:48:in `<top (required)>'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/binstub.rb:11:in `load'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /var/www/dap/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
P.S. Added ruby and rails versions, just in a case.
Rails 4.2 requires ruby version at least 1.9.3. Prefers 2.0+
Don't use outdated version.
Also, is look like you are using system ruby. Don`t use it. Stick to rbenv or RVM
I've got some errors in my Rails app and I'm trying to start the Rails console by issuing following command:
rails console
No matter what I try, I'm always getting the same error:
/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `<top (required)>'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands/console.rb:3:in `require'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands/console.rb:3:in `<top (required)>'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands.rb:37:in `require'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands.rb:37:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I've really tried every possible solution I found on the net, as many people encounter the same error. Unfortunately, nothing seems to work. When I try the following command:
ruby /usr/local/rvm/src/ruby-2.1.1/ext/readline/extconf.rb
I get following output
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no
*** /usr/local/rvm/src/ruby-2.1.1/ext/readline/extconf.rb failed ***
Indicating that something is missing, but installing readline with apt-get doesn't make a difference either. I'm guessing it could have something to do with incompatible gem versions, as the console worked briefly some time ago. Are there any known version issues with readline? Very much people seem to have encountered problems with this gem.
Try putting rb-readline in your Gemfile and check this out https://stackoverflow.com/a/9595841/1905235
If you are running Rails 4.x it is possible that Spring is causing this issue.
Try stopping the Spring process bundle exec spring stop
Then run bundle exec rails c
I finally found a solution. It was a conjunction of several issues (gem versions, conflicting readline libraries).
Firstly, I refetched the readline lib
sudo apt-get install libreadline-dev
Then I uninstalled ruby
rvm remove 2.1.1
I installed ruby again
rvm install 2.1.1
I told RVM to use the default (2.1.1) Ruby
rvm use default
I reinstalled Rails and readline
gem install rails
gem install readline
I got an error again launching the console, but a slightly different one:
/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `require': /usr/local/lib/libreadline.so.6: undefined symbol: UP - /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-linux/readline.so (LoadError)
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `<top (required)>'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands/console.rb:3:in `require'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands/console.rb:3:in `<top (required)>'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands.rb:37:in `require'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands.rb:37:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
So following this instructions (http://vkarthickeyan.wordpress.com/2012/02/16/mysql-symbol-lookup-error-usrlocalliblibreadline-so-6-undefined-symbol-up/), I got it to work:
cd /usr/local/lib
mkdir temp
mv libreadline* temp
ldconfig
apt-get update
Thanks to hunterboerner for the help!
This worked out ok on a Solaris machine that had no readline, might work for you:
$ bundle exec irb
irb(main):001:0> require File.expand_path('config/boot')
=> true
irb(main):002:0> require File.expand_path('config/environment')
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /export/home/deploy/recon/shared/bundle/ruby/1.8/gems/rails-2.3.18/lib/rails/gem_dependency.rb:21.
Warning: NLS_LANG is not set. fallback to US7ASCII.
=> true
irb(main):027:0> require 'console_app'
=> true
I had this problem a while back, solved by typing: rvm requirements and installing what came back. Seemed to, although this was an older version of rvm so may no longer be relevant
rvm reinstall 2.7.0
worked for me
I was doing development on a ruby on a rails application (v2.3) yesterday and decided to update my iMac to OSX Mavericks. Now, every time I try to run my application locally, I get the following error. Does anyone know whats causing this?
Run like this:
script/server -e development
Error:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- script/../config/boot (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from script/server:2:in `<main>'
script/server (file)
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server'
It was working fine before installing OSX Mavericks.
Things I Noticed:
the version of ruby installed in now 2.0 (it was v1.8.7 before)
FYI: I'm still fairly new to rails.
After Installing RVM:
Ok so I setup RVM and made sure the version of ruby (1.8.7) and rails (2.3.11) are installed and configured as the default.
Installed RVM:
curl -L https://get.rvm.io | bash -s stable --rails
Install Ruby 1.8.7:
rvm install ruby-1.8.7-p374
Set v1.8.7 as the default version:
rvm --default use 1.8.7
Install Rails v2.3.11:
gem install rails -v 2.3.11
Install all the gems from system
rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system
Now when I run my app, I get the following error: (what am I missing?)
=> Booting WEBrick...
/Users/imaginationplus/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `gem_original_require': no such file to load -- haml (MissingSourceFile)
from /Users/imaginationplus/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/plugins/haml/init.rb:5:in `evaluate_init_rb'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:95:in `evaluate_init_rb'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:91:in `evaluate_init_rb'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:44:in `load'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:33:in `load_plugins'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:32:in `each'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:32:in `load_plugins'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:292:in `load_plugins'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:142:in `process'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:97:in `send'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:97:in `run'
from /Users/imaginationplus/gitlocal/dfc_workshop/config/environment.rb:14
from /Users/imaginationplus/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `gem_original_require'
from /Users/imaginationplus/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/railties/lib/commands/servers/webrick.rb:59
from /Users/imaginationplus/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `gem_original_require'
from /Users/imaginationplus/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/railties/lib/commands/server.rb:39
from script/server:3:in `require'
from script/server:3
The main thing to understand from this issue is that you cannot rely on the OS for your ruby version or the gems that you are using within a ruby project. As you create additional ruby apps you may run into trouble with this again.
- To manage the gems use Bundler
Bundler maintains a consistent environment for each ruby applications.
- To manage the Ruby versions use rbenv or rvm
the version of ruby installed in now 2.0 (it was v1.8.7 before)
In 2.x version of Ruby, the current directory is no longer in $LOAD_PATH by default. That means that using require to load files relative to the current directory (such as script/../config/boot which expands to simply config/boot) won't work.
Alternatives are:
edit $LOAD_PATH to include the current directory by e.g. $LOAD_PATH << "."
use require_relative
Above solution was found here