I'm unable to get rake precompile tasks running with Rails 3.1.3. I get the following error:
$ rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/tristankromer/.rvm/rubies/ruby-1.9.2-p290/bin/ruby /Users/tristankromer/.rvm/gems/ruby-1.9.2-p290#toomanyninjas/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
rake aborted!
Application has been already initialized.
/Users/tristankromer/.rvm/gems/ruby-1.9.2-p290#toomanyninjas/gems/railties-3.1.3/lib/rails/application.rb:95:in `initialize!'
Same thing happens when I used bundle exec or when I deploy to heroku cedar stack.
Not quite sure where to start on this one. Any ideas?
UPDATE: I'm having issues with every rake task:
rake aborted!
Application has been already initialized.
/Users/tristankromer/.rvm/gems/ruby-1.8.7-p249#joke-off/gems/railties-3.1.3/lib/rails/application.rb:95:in `initialize!'
Upgrading rake to 0.9.2.2 and using ruby 1.9.2-p290 seems to have fixed the issue.
I had this issue, I didn't want to upgrade ruby, and what ended up working for me was the renaming config.ru in RAILS_ROOT to config.ru.bak
http://code.google.com/p/phusion-passenger/issues/detail?id=109
I came across this after realizing I was having an issue getting Passenger to recognize the "RailsEnv" setting my my virtual hosts conf
I had this problem on Rails 3.2.6
The reason it was happening had to do with a path linked gem having a bundle folder. in my gemfile
like so:
gem 'some-gem', :path => "vendor/some-gem"
In order to fix the issue I just moved the bundle folder out of the path linked gem.
mv vendor/some-gem/bundle ~
Once the bundle file was gone it worked perfectly
Related
I am developing a Rails app on Windows 10 under Rails 5.2.1 and Ruby 2.4.4p296
I cannot run the command heroku run rake assets:precompile
I get this error:
C:\Users\Jaiel\Desktop\RubyOnRailsForum>heroku run rake assets:precompile --trace
Running rake assets:precompile --trace on ⬢ warm-mountain-15591... up, run.4644 (Free)
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke yarn:install (first_time)
** Execute yarn:install
Yarn executable was not detected in the system.
Download Yarn at https://yarnpkg.com/en/docs/install
** Execute assets:precompile
Is it even an error? There are assets in the public/assets folder on heroku, however the JavaScript files seem to be not working or are conflicting each other as I also have a problem with them. For example links with method: :delete dont work in my App on Heroku in production environment.
Here is a thread about my problem that is maybe related to it
Try this
$rake assets:precompile (RAILS_ENV=production bundle exec rake assets:precompile is the exact rake task)
Since precompilation is done in production mode only, no need to explicitly specify the environment.
Update:
Try adding the below line to your Gemfile:
group :assets do
gem 'therubyracer'
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
Then run bundle install.
Hope it will work :)
I've recently updated an old application to from 3.2.13 to 4.2.10. I've got the application running in development mode but any rake or rails commands I try to run just hang/freeze. The terminal window will hang for a second and then nothing, I'm unable to even stop the process with ctrl-c. I've read a lot about running 'spring stop' to fix this but I don't have spring installed on this app.
Running the commands with --trace aren't particularly helpful.
rails generate model Foo --trace gives me nothing and rake db:migrate --trace gives me:
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
before freezing. Any pointers in the right direction would be appreciated.
I'm trying to get a basic spree application working on Heroku. I'm following http://railsapps.github.io/rails-heroku-tutorial.html and the spree heroku guide.
I have edited config/application.rb to include config.assets.initialize_on_precompile = false
Then, because I need to precompile before I push to Heroku, I get stuck here:
D:\code\foo>rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
d:/RailsInstaller/Ruby1.9.3/bin/ruby.exe d:/RailsInstaller/Ruby1.9.3/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
Error: Out of stack space
(in D:/code/foo/app/assets/javascripts/admin/all.js)
d:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/execjs-.4.0/lib/execjs/external_runtime.rb:68:in `extract_result'
...much more...
The all.js asset is unchanged from the original installation:
Running
rake assets:clean
before the precompile fixed this for somebody else, but not for me.
Browsing around it looks like this might be a windows specific issue? If it matters I used railsinstaller and I'm running Windows 7 on fairly new laptop.
Then, because I need to precompile before I push to Heroku
This is false. By default, Heroku's Cedar stack compiles your assets during slug compilation when you push to Heroku.
For more information see: https://devcenter.heroku.com/articles/rails-asset-pipeline
Whenever I run rake assets:precompile, I get a manifest.yml file that looks like:
--- {}
Something must be going wrong. Here is my output for rake assets:precompile --trace:
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby /Users/user/.rvm/gems/ruby-1.9.3-p194#global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
** Invoke assets:precompile:nondigest (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:nondigest
Can someone help?? Thanks!
UPDATE:
Feel free to look at my code at www.github.com/sambaek/novulty
When I run rake assets:precompile for your application I get the following output
➜ novulty git:(master) ✗ rake assets:precompile
/Users/deefour/.rbenv/versions/1.9.3-p125/bin/ruby /Users/deefour/.rbenv/versions/1.9.3-p125/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Undefined variable: "$baseLineHeight".
(in /Users/deefour/.rbenv/versions/1.9.3-p125/gemsets/novulty/gems/bootstrap-sass-2.1.0.1/vendor/assets/stylesheets/bootstrap/_accordion.scss)
Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/Users/deefour/.rbenv/versions/1.9.3-p125/...]
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
rake assets:precompile 12.50s user 1.21s system 99% cpu 13.744 total
I'm not sure what your intention is, but you have
app/asssets/bootstrap.min.css being included in app/assets/application.css
gem 'bootstrap-sass' in your Gemfile which appears to cause bootstrap-sass-2.1.0.1/vendor/assets/stylesheets/bootstrap/_accordion.scss (among other files) to be added to your pipeline even though they're not included in require lines in app/assets/application.css
It seems like you have the bootstrap gem included to use it's Javascript plugins, but are trying to omit the SASS files in favor of the hard-coded, minified CSS file?
In any event, the error I get says that the $baseLineHeight SASS variable is not defined for a line in that gem file's asset - an asset you otherwise appear to ignore (from the best I can tell).
I then did the following
Commented out the bootstrap-sass gem in your Gemfile
#gem 'bootstrap-sass'
Ran bundle
Ran rake assets:clean
Removed the following require lines from your app/assets/application.js because they were coming from the bootstrap-sass gem I removed in 1. above
//= require bootstrap-transition
//= require bootstrap-button
//= require bootstrap-carousel
//= require bootstrap-collapse
//= require bootstrap-tab
Ran rake assets:precompile
This results in the following public/assets/manifest.yml.
https://gist.github.com/d29f70b047c7b0606263
I think you need to either of the following
Use the bootstrap-sass gem as intended. Include the SASS files in your app/assets/application.css (doing this it a bit outside the scope of this question)
Get rid of the bootstrap-sass gem as I have above, and include the necessary Javascript files as assets in your vendor/assets/javascripts directory (which is where app/assets/stylesheets/bootstrap.min.css belongs too - vendor/assets/stylesheets)
When i try and preform a rake I get the following. I've tried a few fixed like imploding and reinstalling my rvm - ruby (v1.9.3-p125) but nothing seems to be working. Any ideas?
rake db:seed --trace
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
rake aborted!
stack level too deep
/Users/rm/.rvm/gems/ruby-1.9.3-p125#global/gems/rake-0.9.2.2/lib/rake/task.rb:162
Tasks: TOP => db:seed
if I try and run a rake db:reset --trace
-- initialize_schema_migrations_table()
-> 0.0025s
-- assume_migrated_upto_version(20120803181844, ["/Users/rossmcnairn/rails/search/db/migrate"])
-> 0.0218s
** Invoke db:structure:load_if_sql (first_time)
** Invoke db:create
** Execute db:structure:load_if_sql
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment
** Execute db:abort_if_pending_migrations
rake aborted!
stack level too deep
/Users/rossmcnairn/.rvm/gems/ruby-1.9.3-p125#global/gems/rake-0.9.2.2/lib/rake/task.rb:162
Tasks: TOP => db:setup => db:seed
Ive checked that my bundle exec version and my regular rake versions match.
rake --version
rake, version 0.9.2.2
bundle exec rake --version
rake, version 0.9.2.2
Any help would be greatly appreciated!
Updating OSX is known to give issues in rubies, you should recompile all your rubies:
chown -R $USER: $rvm_path
rvm get head
rvm reinstall 1.9.3-p125
rvm all-gesmsets do rvm gemset pristine
Also note that any other compiled stuff like libraries needs recompilation, this includes homebrew, macports, rvm pkg and any packages you have compiled manually.
** Execute db:abort_if_pending_migrations
rake aborted!
Did you try to run your migrations?
This may be obvious but it took me a few hours. I unwittingly created a class method for the model called create, which is the same as ActiveRecord create. So my seed file has circular reference.
I just kept staring at the seed file and wonder why I get the error while I was able to run it twice before (before adding the class method). Moral of the story: naming is important.