I can't download needed assets and dependencies using $ rake bower:install - ruby-on-rails

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.

Related

Cap production deploy - Rails 6 - Failing

Trying to deploy a rails 6 application to a Digital Ocean droplet.
I run cap production deploy and it fails with this error:
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Command::Failed: rake exit status: 256
rake stdout: Nothing written
rake stderr: rake aborted!
NoMethodError: undefined method `each' for #<String:0x0000565323a30eb8>
/var/www/html/Dev/rails/AppName/config/application.rb:10:in `<module:AppName>'
/var/www/html/Dev/rails/AppName/config/application.rb:9:in `<top (required)>'
/var/www/html/Dev/rails/AppName/Rakefile:4:in `require_relative'
/var/www/html/Dev/rails/AppName/Rakefile:4:in `<top (required)>'
/home/rdevc/.rbenv/versions/2.5.1/bin/bundle:23:in `load'
/home/rdevc/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)
Tasks: TOP => deploy:assets:prepare
(See full trace by running task with --trace)
The deploy has failed with an error: rake exit status: 256
rake stdout: Nothing written
rake stderr: rake aborted!
NoMethodError: undefined method `each' for #<String:0x0000565323a30eb8>
/var/www/html/Dev/rails/AppName/config/application.rb:10:in `<module:AppName>'
/var/www/html/Dev/rails/AppName/config/application.rb:9:in `<top (required)>'
/var/www/html/Dev/rails/AppName/Rakefile:4:in `require_relative'
/var/www/html/Dev/rails/AppName/Rakefile:4:in `<top (required)>'
/home/rdevc/.rbenv/versions/2.5.1/bin/bundle:23:in `load'
/home/rdevc/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)
Any idea what causes this?
The gem dependencies are all satisfied and the server is running the same versions of ruby, rails and ubuntu as I have on my dev box.
I had endless problems deploying this app. Credentials problems, sassc nightmares and more. In the end, I started a new 5.2.2 project, copied in the controllers, models, migrations, views, routes, etc., and changed a few instances of [6.0] to [5.2]. First try deployed perfectly and the app is now live. I can only assume there is something not fully working with my rails 6 install.
Thanks for your replies, guys.

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

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.”

LoadError: libncursesw.so.5: cannot open shared object file: No such file or directory

I'm using Ruby 2.2.2 with Rails 4.2
when i try to run any rake task i have this error message
why is that? and what can i do?
Ruby 2.2.2
Rails 4.2
rbenv
Arch Linux
PostgreSQL database
error message
rake aborted!
LoadError: libncursesw.so.5: cannot open shared object file: No such file or directory - /home/adham/.rbenv/versions/2.2.2/lib/ruby/2.2.0/x86_64-linux/readline.so
/home/adham/.gem/ruby/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
/home/adham/.gem/ruby/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/home/adham/.gem/ruby/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
/home/adham/.gem/ruby/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
/home/adham/.gem/ruby/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
/home/adham/.gem/ruby/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
/home/adham/.gem/ruby/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
/home/code/kahareb/config/application.rb:7:in `<top (required)>'
/home/code/kahareb/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
I had the same error message while trying to run rails console after last Arch Linux update, and I solved it reinstalling ruby (using rvm). Try the following:
$ rvm reinstall 2.2.2

error with rake versioning when running specs in RubyMine; can I manually edit Gemfile.lock

I started getting this error and would like a way to fix it:
You have already activated rake 10.1.1, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this.
I am running this from within RubyMine. I can see in my Gemfile.lock where it specifies 10.1.0. Can I just manually update my Gemfile.lock to 10.1.1?
If I do:
$gem list
....
rake (10.1.1, 10.1.0, 10.0.4, 0.9.2.2)
So I'm not sure why it isn't just working with 10.1.0?
Here's the full output from RubyMine:
/Users/jt/.rvm/rubies/ruby-1.9.3-p448/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/jt/.rvm/gems/ruby-1.9.3-p448/bin/rake spec
Testing started at 3:15 PM ...
rake aborted!
You have already activated rake 10.1.1, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this.
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup'
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:19:in `setup'
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'
/Users/jt/repos/app/config/boot.rb:6:in `<top (required)>'
/Users/jt/repos/app/config/application.rb:1:in `<top (required)>'
/Users/jt/repos/app/Rakefile:5:in `<top (required)>'
-e:1:in `load'
-e:1:in `<main>'
(See full trace by running task with --trace)
Process finished with exit code 1
You can remove your
Gemfile.lock file
and exec
bundle update

sunspot_solr error on heroku?

I'm using 'sunspot_rails', '~> 2.0.0.pre.120415' for Solr search in my rails app and deploy it on heroku (two separate application).
It's working fine on one application but throw error on other.
I have checked the heroku environment and found that -
one app is on cedar stack and ruby version is 1.9.2p290. (Working fine)
other one is on bamboo stack and ruby version is 1.9.2p180 (throw error)
So, Is this the ruby version problem or heroku stack problem ?
Ruby version on development environment is 1.9.2p290.
Error
$ heroku run rake sunspot:reindex
Running rake sunspot:reindex attached to terminal... up, run.8567
rake aborted!
uninitialized constant Sunspot::Adapters::Registry::Forwardable
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot/adapters.rb:310:in `<class:Registry>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot/adapters.rb:309:in `<module:Adapters>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot/adapters.rb:34:in `<module:Sunspot>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot/adapters.rb:1:in `<top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot.rb:18:in `block in <top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot.rb:15:in `each'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot.rb:15:in `<top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot_rails-2.0.0.pre.120925/lib/sunspot/rails.rb:1:in `<top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot_rails-2.0.0.pre.120925/lib/sunspot_rails.rb:6:in `<top (required)>'
/app/config/application.rb:7:in `<top (required)>'
/app/Rakefile:4:in `require'
/app/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
To be even more clear, at the top of adapters.rb (sunspot/lib/sunspot/adapters.rb), add the following line:
require 'forwardable'
module Sunspot
#
# Sunspot works by saving references to the primary key (or natural ID) of
I have found the solution.
Actually it's a environment problem on heroku.On local system the ruby version is ruby 1.9.2p290 and on heroku is ruby 1.9.2p180. Ruby 1.9.2p180 doesn't include 'Forwardable' module. So I just need to include 'Forwardable' module in my application.

Resources