ruby on rails ails with couldn't find file 'jquery.ui.all' - ruby-on-rails

couldn't find file 'jquery.ui.all' which is a known issue, I added *=require jquery.ui.all to application.css and //= require jquery.ui.all to application.js but still get the error. http://bpaste.net/show/1RqTDUte2XLBoj8fdTbf/
Sprockets::FileNotFound in Preorder#index
Showing /var/www/localhost/htdocs/selfstarter/app/views/layouts/application.html.erb where line #6 raised:
couldn't find file 'jquery.ui.all'
(in /var/www/localhost/htdocs/selfstarter/app/assets/stylesheets/application.css:14)
Extracted source (around line #6):
3: <head>
4: <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
5: <title><%= Settings.product_name %></title>
6: <%= stylesheet_link_tag "application" %>
7: <%= javascript_include_tag "application" %>
8: </head>
9: <!--[if lt IE 9 ]><body class="lt-ie9"><![endif]-->
http://bpaste.net/show/110613/
http://bpaste.net/show/110612/

In version 4 it used to be
//= require jquery.ui.all
But from version 5.0:
application.js:
//= require jquery-ui
application.css:
/*
*= require jquery-ui
*/

In order to require assets from jQuery UI, you need to install it first.
In Gemfile, add:
gem 'jquery-ui-rails'
Then run bundle install and restart the rails server.

I have faced the same problem..
What happened to my project is, my gemfile.lock got updated and it was set to use the latest version of all the gems..
In case of jquery-ui-rails 4.2.1 we have been using 4.2.1 and by mistake gemfile.lock got updated and used the 5.0.2.
In jquery-ui-rails 5.0.2 the file jquery.ui.all.js is no more available.
So I was facing the error couldn't find file 'jquery.ui.all'
So to avoid such errors I prefer to use the tilde sign for version number in gemfile
Example:
gem 'jquery-ui-rails', '~> 4.2.1'
~> makes the bundler to update the gem until version reaches to 4.2.9 and wont update if version reaches to 4.3.0
You know that if drastic changes occur in the gem then version number must reach 4.3.0
Update the gem if you know what changes have been made exactly and you are ready to upgrade.

Restart the server to fix this issue.
Worked for me.

actually the solution was to clone a fresh copy of my repo an run
bundle install --without production
bundle exec rake db:migrate
bundle exec rake db:seed
rails s

Related

Angular Templates on Rails

I'm using the angular-rails-templates gem. I have a folder in my /app/assets/javascripts called templates and I have included it in application.js:
//= require_tree ./templates
Inside of templates there is a test.html file with <h1>hello world</h1>.
For some reason, test.html is not being found though, when I log out $templateCache.info() (using app.run) in the console I have:
Object {id: "templates", size: 0}
This turned out to be a sprockets incompatibility (see here)
The short version is:
Add gem 'sprockets', '2.12.3' to your Gemfile
Run bundle update sprockets

NoMethodError in Pages#home undefined method `environment' for nil:NilClass

My relatively basic app was working fine then all of a sudden I ran into the following error. I have tried to solve this on my own with no luck. I thank any of you in advance for hoping me to solve this issue.
NoMethodError in Pages#home undefined method `environment' for nil:NilClass (in /Users/kevindark/Site Name/app/assets/stylesheets/application.css.scss)
The exception page indicated the problem was extracted from the stylesheet_link_tag line of code below.
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title><%= #title || "Site Name" %></title>
<%= favicon_link_tag 'favicon.ico' %>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
Adding application.css.scss
/*
* Overwritten by RailsBricks
*
*= require_self
*/
#import "framework_and_overrides";
framework_and_overrides.css.scss available at the link below.
https://gist.github.com/kdark11/9537485
This happened to my Rails app today as well.
It was driving me crazy and your question was the only hit on Google for the problem.
It turns out it was caused by the seemingly-harmless running of "bundle update" (just after adding a gem) which upgraded the 'sprockets' gem to '2.12.0'.
I forced sprockets to use the previous version with:
gem 'sprockets', '2.11.0'
in the Gemfile, then ran
bundle update
...and this solved it for me. edit: restart the server to finish, as the user below stated (thanks). Wow, if I had a dollar for every server restart during development! :-D
Major changes to resources and configuration always require a server restart.
2.12.0 was only released today, so I guess it has a bug or an incompatibility with some other gems we are using. I don't know for sure, I'm a bit of a n00b myself.
I hope this helps!
Edit: For the record, I can verify that faker and sass are not involved as they were installed/upgraded around the same time as the breaking update and I eliminated each. I can't speak for other gems but sprockets definitely is part of the problem here.
Downgrading to:
gem 'sprockets', '2.11.0'
...didn't work for me.
It turned out that I needed to lock slim as well:
gem 'sprockets', '2.11.0'
gem 'slim', '2.0.0'
I ran into this problem while trying to get my app to work. After much trial and error the solution was indeed to update the sprockets gem with:
gem 'sprockets', '2.11.0'
and running
bundle update
Do not forget to restart your rails server, because at first I did not think the solution worked. All that I needed was to restart the server however.
FWIW, I upgraded sprockets to 2.12.3 and I don't get the error anymore. I'm using Rails 4.1.8.
I had this error using Rails 4.2.0 after upgrading from sprockets 2.12.3 to 3.0.1. I needed to actually add the sprockets gem in my Gemfile, and lock the version at 2.12.3.
In my Gemfile:
gem 'sprockets', '2.12.3'
This cleared everything up for me.

Zurb Foundation 5, modernizr not found

I get this when using Foundation 5.0.2.0 in production mode.
On Rails, Unicorn, NginX & Ubuntu.
"NetworkError: 404 Not Found - http://mydomain.com/javascripts/vendor/modernizr.js"
Update 3/13/14
I don't have this problem on heroku with foundation-rails-5.1.1.0. Adding javascript_include_tag "vendor/modernizr" in the head works. I could remove the modernizr I copied to the vendor directory and remove the extra line in app.js
I had the same problem on heroku, the app would crash because it couldn't find modernizr.js. Here's how I fixed it:
Copy modernizr.js from foundation (wherever you installed it with bundler) into vendor/assets/javascripts/.
Add //= require modernizr below //= require_tree . on application.js.
Remove javascript_include_tag "vendor/moderizr" from application.html
I got the same error as you and I did this to fix it:
In config/environments/production.rb, set this:
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = true
Try updating the gem you're using for Foundation. This commit from five days ago may help you since it claims to add a missing modernizr.js file.
There is an issue with the version of the foundation-rails gem you are using. In fact even the latest version currently available (5.0.3.1) has this problem. There is a pull request which claims to fix this: https://github.com/zurb/foundation-rails/pull/71 but another option for now is to update your gem to 5.0.3.1 and add this line to your production.rb file:
config.assets.precompile += %w( vendor/modernizr.js )
Please follow the manual instructions from zurb here:
http://foundation.zurb.com/docs/applications.html
Which specifiy that the modernizr script be included inside the head tag. I ran into this issue and then fixed it using the following code in layouts/application.rb:
%head
%title= title
= stylesheet_link_tag "application"
= javascript_include_tag "vendor/modernizr"
= csrf_meta_tags
= favicon_link_tag
= yield(:head)
I am using foundation-rails (5.2.2.0) and I solved it by just adding:
//= require modernizr
below
//= require_tree .
in app/assets/javascripts/application.js

Couldn't find file 'jquery', Sprockets::FileNotFound in StaticPages#home error

I am self-studying Michael Hart's guide and am stuck in chapter 7.
When I go to localhost:3000, an error message comes up, saying it couldn't find file jquery and points to line 7 in application.html.erb file.
when I delete the line 7, -> <%= javascript_include_tag "application", "data-turbolinks-track" => true %>, localhost runs normal without an error.
My git repository.
I solved this by reverting to
gem 'jquery-rails', '2.1.4'
gem 'jquery-ui-rails', '4.2.1'
I asume you did'nt run 'bundle install' because:
In application.js you require jquery which should usually come with the the gem 'jquery-rails', '2.2.1'
I removed Gemfile.lock and ran bundle install once again, and it solved the problem.
I solved this by... restarting server! It recollected the libraries and worked like charm.

Ruby on Rails error "cannot load such file -- less"

I am fairly new to ruby on rails, I have been trying to use twitter-bootstrap as an asset, so I have included it in my Gemfile, bundled and it installs successfully. However I have noticed that it relies on certain dependencies that are not shown when I do the "bundle" command.
The dependences it needs
(1) Libv8
(2) Less
(3) Less-rails
Error message:
cannot load such file -- less
(in c:/Sites/todo/app/assets/stylesheets/bootstrap_and_overrides.css.less)
[code]
Extracted source (around line #8):
5: <!--[if lt IE 9]>
6: <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
7: <![endif]-->
8: <%= stylesheet_link_tag "application", :media => "all" %>
9: <%= javascript_include_tag "application" %>
10: <%= csrf_meta_tags %>
11: <meta name="viewport" content="width=device-width, initial-scale=1.0">
[/code]
Trace
app/views/layouts/application.html.erb:8:in `_app_views_layouts_application_html_erb__560528188_27183396'
app/controllers/lists_controller.rb:7:in `index'
I have noticed a lot of answers to this very question already, and have chosen the obvious solutions, but somehow I still get stuck, and would really appreciate some guidance.
I guess you are using sass instead of LESS.
Have you tried the twitter-bootstrap-rails gem?
gem "therubyracer"
gem "less-rails"
gem "twitter-bootstrap-rails"
https://github.com/seyhunak/twitter-bootstrap-rails
I simply needed to restart my server.
I had added the three gems listed above (less-rails, therubyracer, and twitter-bootstrap-rails, with Rails 3.2.13) while my local server was running, resulting in the problem seen above. So once I shut it down and restarted it again, everything loaded well.
You have to either update therubyracer or downgrade the twitter-bootstrap-rails gem down to version 2.1.7 which is the last known version that didn't have this issue.
Run either bundle update to update your gems or in your Gemfile make your twitter-bootstrap-rails gem look like this:
gem 'twitter-bootstrap-rails', '2.1.7'
Take a look at this issue:
https://github.com/seyhunak/twitter-bootstrap-rails/issues/465
This issue started happening on versions after 2.1.7 on twitter-bootstrap-rails.
If you are getting it under Windows this should help you
therubyracer_for_windows
It helped me
perhaps you are on windows ... there is no libv8 for windows and no binary therubyracer because it depends on libv8

Resources