$ rails -T & $ rails server (puma) is failing - ruby-on-rails

I have a rails 5.2.0 set up on my macos catalina with rbenv 1.1.2/ruby 2.5.1. At the root of my app I get the following error:
$ rails -T
rails aborted!
LoadError: dlopen(/Users/sa/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ffi-1.11.1/lib/ffi_c.bundle, 9): Symbol not found: _ffi_type_double
Referenced from: /Users/sa/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ffi-1.11.1/lib/ffi_c.bundle
Expected in: flat namespace
in /Users/sa/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ffi-1.11.1/lib/ffi_c.bundle - /Users/sa/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ffi-1.11.1/lib/ffi_c.bundle
/Users/sa/Projects/ror/bubblin.io/bubblin.io/config/application.rb:7:in `<top (required)>'
/Users/sa/Projects/ror/bubblin.io/bubblin.io/Rakefile:1:in `<top (required)>'
bin/rails:4:in `<main>'
Caused by:
LoadError: cannot load such file -- 2.5/ffi_c
/Users/sa/Projects/ror/bubblin.io/bubblin.io/config/application.rb:7:in `<top (required)>'
/Users/sa/Projects/ror/bubblin.io/bubblin.io/Rakefile:1:in `<top (required)>'
bin/rails:4:in `<main>'
Caused by:
Bootsnap::LoadPathCache::FallbackScan:
(See full trace by running task with --trace)
I can provide the full trace but just to know I reinstalled everything from scratch and my xcode-command-line tools/gcc are up-to-date. Is this something that has come up/been solved before?

After struggling for a week with this issue, I was forced to uninstall rbenv and purge all rubies under rbenv from my machine. I am now using the system rubies instead. My macbook pro has ruby 2.6.5 by default, so I bumped up the .ruby-version on my app from 2.5.1 to 2.6.7 to make sure i was on a development environment that “worked.”

Related

(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')) on apple M1 chip when running rake db:create

when I try to create my database this error appear
$ rake db:create
rake aborted!
LoadError: dlopen(/Users/agonzalez/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/nokogiri-1.13.6/lib/nokogiri/nokogiri.bundle, 0x0009): tried: '/Users/agonzalez/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/nokogiri-1.13.6/lib/nokogiri/nokogiri.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')) - /Users/agonzalez/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/nokogiri-1.13.6/lib/nokogiri/nokogiri.bundle
/Users/agonzalez/Documents/join/config/application.rb:7:in `<top (required)>'
/Users/agonzalez/Documents/join/Rakefile:4:in `require_relative'
/Users/agonzalez/Documents/join/Rakefile:4:in `<top (required)>'
Caused by:
LoadError: cannot load such file -- /Users/agonzalez/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/nokogiri-1.13.6/lib/nokogiri/2.7/nokogiri
/Users/agonzalez/Documents/join/config/application.rb:7:in `<top (required)>'
/Users/agonzalez/Documents/join/Rakefile:4:in `require_relative'
/Users/agonzalez/Documents/join/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
I already try
bundle config set force_ruby_platform true
My ruby version is ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [-darwin21]
bundle version 2.1.4
Rails version 5.2.7
Nokogiri version nokogiri-1.13.6
I was having a similar issue, ultimately what fixed it was uninstalling nokogiri and then reinstalling it with specific platform like so:
gem uninstall nokogiri
gem install nokogiri -v 1.13.6 --platform arm64-darwin
This got me up and running for the time being. I suspect it may break again if I ever do a bundle install in the future, there may be a way to fix this via editing the Gemfile but I'm not sure what that would look like.
The above answers have no effect on me.
Following the steps below works for me:
:bundle config --global build.ffi --enable-libffi-alloc
:rm -rf ~/.bundle/vendor

rake db create aborted

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

I can't download needed assets and dependencies using $ rake bower:install

my environments are follows
os. : mac
rails : 5.0.5
rvm : ruby-2.4.0
node : v6.11.2
npm. : 5.3.0
To download needed assets I run the following command on terminal.
$ rake bower:install
and i got follow errors.
rake aborted!
NoMethodError: undefined method `load_defaults' for #<Rails::Application::Configuration:0x007feb54ef8b38>
/Users/admin/.rvm/gems/ruby-2.4.0/gems/railties-5.0.5/lib/rails/railtie/configuration.rb:95:in `method_missing'
/Users/admin/workspace/now/angular_example/config/application.rb:12:in `<class:Application>'
/Users/admin/workspace/now/angular_example/config/application.rb:10:in `<module:AngularExample>'
/Users/admin/workspace/now/angular_example/config/application.rb:9:in `<top (required)>'
/Users/admin/workspace/now/angular_example/Rakefile:4:in `require_relative'
/Users/admin/workspace/now/angular_example/Rakefile:4:in `<top (required)>'
/Users/admin/.rvm/gems/ruby-2.4.0#global/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
In Rails 4.1.4, and maybe some other versions after 4.0.8, the first line in those files is generated as Rails.application.configure.do rather than, using a project called sample_app as an example, SampleApp::Application.configure.do as in 4.0.8.

CentOS release 6.7: bin/rails c staging error: uninitialized constant Bundler(NameError)

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.

Problems running rails server

I just installed the rails env using the Rails installer on my Mac OSX 10.7.4.
I create a project using the "rails new" command.
When I try to run the "rails server" command I get this message:
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/options.rb:32:in `default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/base.rb:90:in `<class:Base>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/base.rb:85:in `<module:Generator>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/base.rb:48:in `<module:Rails>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/base.rb:6:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator.rb:37:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/bin/rails:15:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/rails:23:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/rails:23:in `<main>'
When I run the $ ruby -v and $ gem -v, I get "ruby 1.9.3p194" and "1.8.24" respectively. What am I missing here? How can I get this server to run?
It looks like you are trying to use a Rails 3.x command with Rails 2.3. Pre 3.0 you have to use the server script.
From within your application directory run:
./script/server
Install rails as a gem, gem install rails . As your are using rvm, the folder path displayed here shows rails 2.3.4, while you tried to run rails server . Check/change the rails version in your gem file and then do bundle install.

Resources