estimatemyproject.com is running on ruby on rails for more than 2 years without any problems.
But just today it stopped loading assets .
I searched online and tried
rake assets:precompile --trace RAILS_ENV=production
but it fails:
root#emp:/home/emp/current# rake assets:precompile --trace RAILS_ENV=production
rake aborted!
/home/emp/emp/releases/20160127092918/config/application.rb:7: syntax error, unexpected ':', expecting ')'
Bundler.require(*Rails.groups(assets: %w(development test)))
^
/home/emp/emp/releases/20160127092918/config/application.rb:7: syntax error, unexpected ')', expecting kEND
Bundler.require(*Rails.groups(assets: %w(development test)))
^
/home/emp/emp/releases/20160127092918/config/application.rb:60: syntax error, unexpected $end, expecting kEND
/home/emp/emp/releases/20160127092918/Rakefile:5:in `require'
/home/emp/emp/releases/20160127092918/Rakefile:5
/usr/lib/ruby/vendor_ruby/rake/rake_module.rb:25:in `load'
/usr/lib/ruby/vendor_ruby/rake/rake_module.rb:25:in `load_rakefile'
/usr/lib/ruby/vendor_ruby/rake/application.rb:501:in `raw_load_rakefile'
/usr/lib/ruby/vendor_ruby/rake/application.rb:82:in `load_rakefile'
/usr/lib/ruby/vendor_ruby/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/vendor_ruby/rake/application.rb:81:in `load_rakefile'
/usr/lib/ruby/vendor_ruby/rake/application.rb:65:in `run'
/usr/lib/ruby/vendor_ruby/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/vendor_ruby/rake/application.rb:63:in `run'
/usr/bin/rake:27
Help me to debug this please!
Need the assets to reload or refresh the cache somehow.
Thanks!
I tried using the change diego suggested :
It gives me a different error now.
rake aborted!
no such file to load -- rubygems
/home/emp/emp/releases/20160127092918/config/boot.rb:1:in `require'
/home/emp/emp/releases/20160127092918/config/boot.rb:1
/home/emp/emp/releases/20160127092918/config/application.rb:1:in `require'
/home/emp/emp/releases/20160127092918/config/application.rb:1
/home/emp/emp/releases/20160127092918/Rakefile:5:in `require'
/home/emp/emp/releases/20160127092918/Rakefile:5
/usr/lib/ruby/vendor_ruby/rake/rake_module.rb:25:in `load'
/usr/lib/ruby/vendor_ruby/rake/rake_module.rb:25:in `load_rakefile'
/usr/lib/ruby/vendor_ruby/rake/application.rb:501:in `raw_load_rakefile'
/usr/lib/ruby/vendor_ruby/rake/application.rb:82:in `load_rakefile'
/usr/lib/ruby/vendor_ruby/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/vendor_ruby/rake/application.rb:81:in `load_rakefile'
/usr/lib/ruby/vendor_ruby/rake/application.rb:65:in `run'
/usr/lib/ruby/vendor_ruby/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/vendor_ruby/rake/application.rb:63:in `run'
/usr/bin/rake:27
You have a syntax error in config/application.rb line 7.
Seems like you're using an old version of Ruby that does not support the colon hash syntax. Change this:
Bundler.require(*Rails.groups(assets: %w(development test)))
to:
Bundler.require(*Rails.groups(:assets => %w(development test)))
Fix that and redeploy your app and rerun the rake command.
Related
I am in the process of developing a Rails Engine (currently using Rails 4.1.6). I get this error when I try to run any Rake tasks:
$ bundle exec rake app:db:migrate --trace
** Invoke load_app (first_time)
** Execute load_app
rake aborted!
NameError: uninitialized constant Thor::Base
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/ui/shell.rb:12:in `initialize'
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/gem_helper.rb:26:in `new'
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/gem_helper.rb:26:in `initialize'
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/gem_helper.rb:13:in `new'
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/gem_helper.rb:13:in `install_tasks'
/Users/andrew/example_rails_engine/Rakefile:10:in `<top (required)>'
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/Users/andrew/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/Users/andrew/.rbenv/versions/2.1.3/bin/rake:23:in `load'
/Users/andrew/.rbenv/versions/2.1.3/bin/rake:23:in `<main>'
My Rakefile is as follows:
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'
Bundler::GemHelper.install_tasks
This error doesn't make sense to me. I'm guessing Thor is a dependency of Rails Rake tasks. Where is this error coming from and how do I fix it?
adding
require 'thor'
to your RakeFile before
Bundler::GemHelper.install_tasks
fixed the issue for me
This seems to be an issue with either:
Bundler: https://github.com/bundler/bundler/issues/3205
or guard-rspec: https://github.com/guard/guard-rspec/issues/258
Guard lists Thor as a dependency, while Bundler vendors its own version of Thor, causing some sort of conflict.
I was able to temprorarily fix the problem by changing the order in which the code is loaded:
Move this line: Bundler::GemHelper.install_tasks above these lines:
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'
When I push my ruby on rails app to heroku all the images don't load.
I have attempted to precompile all assets but I get this error:
jack:my_first_ruby_app Jack$ bundle exec rake assets:precompile
rake aborted!
/Users/Jack/Sites/my_first_ruby_app/Rakefile:1: unknown regexp option - b
/Users/Jack/Sites/my_first_ruby_app/Rakefile:1: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
/Users/Jack/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.0.4/lib/rake/application.rb:589:in `raw_load_rakefile'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.0.4/lib/rake/application.rb:89:in `block in load_rakefile'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.0.4/lib/rake/application.rb:88:in `load_rakefile'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.0.4/lib/rake/application.rb:72:in `block in run'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195#global/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `eval'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `<main>'
Contents of Rakefile:
/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
MyFirstRubyApp::Application.load_tasks
Version of Ruby 2.0.0p195
Please Edit your Rakefile
and commented the line 1
like this
#!/usr/bin/env rake
I have upgraded rails 2.3.11 to rails 3.0.8 using rails_upgrade plugin. Now I am getting this error and I do not understand why. Any help you can provide is appreciated!
rake aborted!
no such file to load -- tasks/rails
/home/mpn/mpn_admin/branches/to_rails3/Rakefile:13:in `require'
/home/mpn/mpn_admin/branches/to_rails3/Rakefile:13:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:495:in `raw_load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:78:in `block in load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:77:in `load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:61:in `block in run'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'
Check your RakeFile to make sure it doesn't have the old Rails 2 artifacts left in it. The error is getting thrown in the RakeFile so that's probably the cause and the upgrade plugin would not have caught that.
Here is what a sample Rails 3 RakeFile looks like:
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
MyAppNameGoesHere::Application.load_tasks
I am working on Ubuntu 10.04 LTS, Lucid Lynx, have installed Ruby on Rails 3 on it. I am not able to start Rails server. I am getting the following error.
mah#mah-laptop:~/Desktop/projects/ver$ rails s
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands.rb:29:in `block in <top (required)>': undefined method `root' for nil:NilClass (NoMethodError)
from /home/mah/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands.rb:27:in `tap'
from /home/mah/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I am using Rails 3.0.8 and rake version 0.8.7
I tried bundle exec but got same error.
Thanks for any help in advance
UPDATE
Here is what I get after bundle exec rake db:migrate --trace
mah#mah-laptop:~/Desktop/projects/ver$ bundle exec rake db:migrate --trace
rake aborted!
uninitialized constant Ver
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing_from_s3_library'
/home/mah/Desktop/projects/ver/Rakefile:7:in `<top (required)>'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:495:in `raw_load_rakefile'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:78:in `block in load_rakefile'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:77:in `load_rakefile'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:61:in `block in run'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/home/mah/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `load'
/home/mah/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `<main>'
This error means that Rails.application isn't initialized. I didn't actually know that, I
cheated.
So that then begs the question: how did you set up this application?
Perhaps this application doesn't contain a config/application.rb file that defines a class that inherits from Rails::Application and therefore is causing this problem. In my application here, I've got this one you could use as an example.
When running rake db:create or rake db:migrate locally my app successfully builds the tables as expected. When running on heroku however (eg. heroku rake db:migrate --trace --app ) it is giving me the following error all of a sudden:
C:\>heroku rake db:migrate --trace --app foo rake aborted!
undefined method `task' for #<Foo::Application:0x7f8e77aa1420>
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:214:in `initialize_tasks'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:139:in `load_tasks'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `send'
/app/.bundle/gems/ruby/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `method_missing'
/app/Rakefile:7
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:495:in `raw_load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:78:in `load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:77:in `load_rakefile'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:61:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/lib/rake/application.rb:59:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.0/bin/rake:31
/usr/ruby1.8.7/bin/rake:19:in `load'
/usr/ruby1.8.7/bin/rake:19
Looking at the Rakefile this is all that's present:
require File.expand_path('../config/application', __FILE__)
require 'rake'
Foo::Application.load_tasks
The load_tasks line is line 7. I'm really not sure what changed but something sure has. Has anyone had experience with this error?
See that
There's an issue with Rake 0.9.0. Use 0.8.7 in your Gemfile for now.