My rake assets:precompile are not working on production environment, I'm getting "Out of stack space" error
I'm running rake on Windows 7 with 8 GB, so memory is not a problem at all. This guy rake assets:precompile giving "Error: Out of stack space" error said that running on Ubuntu solved his problem, but I do not plan to do this...
After run a trace I noticed that the precompile always stopped on my application.js, here is the code:
//= require jquery
//= require jquery-ui
//= requeire jquery_ujs
//= require turbolinks
//= require calendarize
//= require_tree .
some days ago it was working, actually the only difference is the calendarize, a gem that I added. But I tried to remove it from application.js and the error continues
I'm on Rails 4 and Ruby 2 - If anyone can help it would be great! Thanks!
EDIT: I didn't had jquery-ui before to! Not using this version on gem file at least: gem "jquery-rails", "~> 2.3.0"
EDIT2: Just updated jquery-rails and added jquery-ui-rails, got the same problem. Them tried to remove everything from application.js. Same problem.
Try
rake assets:clean
and next,
rake assets:precompile
If it's not working yet try like below and trace what is the problem.
rake assets:precompile --verbose
BTW, I strongly recommend use RoR on the OSX or Ubuntu except for Windows.
There are various barriers even though you solve this problem..
Cheers, humbroll.
After research a lot, I find out that this is a Windows problem. Don't know why this happens, but I installed an ubuntu develop environment and everything works fine!
Related
I'm on Rails 5.1 using Bootstrap 4.0.0-beta.
I am having difficulties deploying to production (development works fine, without Yarn).
Yarn is working and I have package.json and node_modules.
I have been following Nithin's walkthrough. My styles are working; however, my javascript does not work.
I've tried addind popper.js using //= require popper.js/dist/umd/popper, but this hasn't helped.
None of my javascript works. For example, all dropdowns are completely dead.
Does anyone have any suggestions?
UPDATE
I checked out in development with Yarn and it failed. So all the files are added to the head, but do not work!
Any suggestions are appreciated!
Your format is wrong here:
\\= require popper.js/dist/umd/popper
Check you're using the correct folder for popper.js, and -- if that's correct --
use the following format:
//= require popper.js/dist/umd/popper
Hope that helps.
Finally, I got the Bootstrap working! I removed it with yarn remove bootstrap and reinstalled it with yarn add bootstrap#4.0.0-alpha.6
Then I added //= require tether/dist/js/tether to application.js right upon //= require bootstrap/dist/js/bootstrap
Also I removed //= require popper.js/dist/umd/popper cause the alpha version seems to be working fine without it.
I'm trying to push my Rails 3.2 app up to Heroku, but the push gets rejected because Sprockets can't find the directory I'm referencing with require_tree.
In app/assets/javascripts/application.js:
//= require_tree ../../../vendor/assets/extender/
The error portion of the build looks like:
Running: rake assets:precompile
rake aborted!
Sprockets::ArgumentError: require_tree argument must be a directory
(in /tmp/.../app/assets/javascripts/application.js:1)
As I understand it items under vendor/assets/ should be available as though they were under app/assets/, but I can't seem to get that to work and the way I'm doing it above works locally, so I'm running with it.
What I don't understand is why this works locally but not when pushing to Heroku. Any help is greatly appreciated!
Solved: for some reason my .gitignore was ignoring /vendor.
app/assets/javascripts and vendor/assets/javascripts get merged into the same level, so you should require_tree extender if vendor/assets/javascripts/extender/ exists.
You shouldn't go have to do ../../../vendor/assets/javascripts/. See Search Paths in http://guides.rubyonrails.org/asset_pipeline.html#asset-organization
I just upgraded our Rails app from 4.2.5 to 5.0.1
The rails server boots up fine but when I try to load a page I'm now getting the error:
Sprockets::FileNotFound - couldn't find file 'jquery-ui/autocomplete' with type 'application/javascript'
When I run bundle I can see
Using jquery-rails 4.2.2
Using jquery-ui-rails 6.0.1
change the line in application.js
from
//= require jquery-ui/autocomplete
to
//= require jquery-ui/widgets/autocomplete
Seems the file paths have changed. According to the gem readme:
Warning:
Due to directory structure changes between jQuery UI 1.10, 1.11, and 1.12, if you use version is lower than 6.0, you will have to use a different naming for the files to require, please check following links for more information: for 5.0 users, for 4.2 users.
My case was exceptionally weird. When I set up my old legacy app in Ubuntu 20 it worked fine until I rebooted my laptop. After that it displayed the error under question. I checked that I use correct RVM gemset with correct ruby version, gems were bundled as they should have.
When I changed the
//= require jquery-ui/autocomplete
to
//= require jquery-ui/widgets/autocomplete
this line passed and worked fine, but next ones starting causing problems.
Eventually I had to change all the following lines:
//= require jquery-ui/widgets/autocomplete
//= require jquery-ui/widgets/datepicker
//= require jquery-ui/widgets/droppable
EXCEPT THIS:
//= require jquery-ui/effect and I have no idea why this single line works while others don't :/
Rails 4.1+, so there isn't built-in support for an :assets group
I want to keep Heroku's precompile on push behaviour, but don't want the asset gems loaded by the rails server. We don't use any kind of inline coffeescript or scss template rendering in the app, only in the assets, so it's just wasted memory at runtime.
I've played around with extending the rake task, configuring sprocket-rails, and even changing application.js to application.js.erb and adding things like
//= <% require 'jquery-rails' %>
//= require 'jquery'
but still get these errors:
Sprockets::FileNotFound: couldn't find file 'jquery'
This comment from a rails issue complaining about the same problem also doesn't work for me now, and it's a couple of years old so perhaps something changed that breaks it? Or am I doing it wrong?
If I keep the asset gems in the default Gemfile group everything works fine.
The point here is to not have them loaded in the production environment, but to have
RAILS_ENV=production rake assets:precompile task
load them before it executes (and fails because of missing libraries)
This should have been a no-brainer, but has me stumped.
For convenience, I took a bootstrap plugin (bootstrap-combobox) and turned it into a gem, so I can version it properly and all.
My gem is bootstrap-combobox-rails.
It packages up fine, bundle installs fine, but when I try to reference the assets: The stylesheet works, although I have to do it like this in my application.css.scss:
#import "bootstrap-combobox.css";
(everything else is fine without the .css).
The javascript is not found, though. No matter if I reference it as
//= require bootstrap-combobox.js
or
//= require bootstrap-combobox
I get:
$ rake assets:precompile
/Users/denishaskin/.rvm/rubies/ruby-1.9.3-p374/bin/ruby /Users/denishaskin/.rvm/gems/ruby-1.9.3-p374#oneclick/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
couldn't find file 'bootstrap-combobox.js'
(in /Users/denishaskin/clients/cs/1-click/oneclick/app/assets/javascripts/application.js:18)
Suggestions? Thanks...
Resolved this.
It was one or both of these things, I don't recall exactly which did it. Both are described here.
Making the gem into a Rails::Engine
Adding the dependency on railties into the gemspec