8

Okay, this is driving me nuts. I've been following the instructions to install a JQuery datepicker here: http://railscasts.com/episodes/213-calendars-revised but I'm getting hung up on this error:

Sprockets::FileNotFound in Verifications#new

couldn't find file 'jquery.ui.datepicker'
  (in /app/assets/stylesheets/application.css:11)

Here's application.js:

//= require jquery
//= require jquery.ui.all
//= require jquery_ujs
//= require_tree .

Here's application.css:

 *= require jquery.ui.datepicker
 *= require_self
 *= require_tree .

and in Gemfile:

group :assets do
  gem 'jquery-ui-rails'
end

Anyone see what I'm missing?

6 Answers 6

31

For future readers. First, make sure you've restarted your rails server after installing the gem as krstck answered.

Then, double check the version of your gem. jquery-ui-rails has changed its require syntax in 5.0.0. Now you should write:

//= require jquery-ui/datepicker

Also add to css

*= require jquery-ui/datepicker
Sign up to request clarification or add additional context in comments.

1 Comment

And *= require jquery-ui/datepicker to css
18

Answering my own question here in case someone else makes the same dumb mistake. I restarted the rails server, and then it worked.

2 Comments

I had the same error but for bootstrap-datetimepicker. Restarting the Rails server worked.
All other solutions failed for me - this was the ticket!
16

For Rails 5 users, to use the jQuery datepicker you must add this to your application.js:

//= require jquery-ui/widgets/datepicker

And this to your application.css:

/*
 *= require jquery-ui/datepicker
 */

You can also just use the usual gem version:

gem 'jquery-ui-rails'

Restart your server as well.

Here is the documentation

4 Comments

This has got nothing to do with Rails 5, but rather it is a consequence of upgrading from jquery-ui v5.x --> 6.0. The offending line has changed from require jquery-ui/datepicker to require jquery-ui/widgets/datepicker.
if using sass, need to put @import 'jquery-ui/datepicker';
@TomLord is right. You can look into the gem and see how there's a widgets subdirectory in that version of jquery-ui. I'm using rails 4 and the same. Refer to readme
Also worth emphasizing for tired dolts like me that for jquery-ui-rails 6.0 users, it's //=require jquery-ui/widgets/whatever in application.js ... but /widgets does not need to be added in application.css. (The answer above is correct, just emphasizing it because I totally missed it initially.)
8

adds 'jquery-ui-rails' on your Gemfile, and use a hyphen instead of a point to require jquery-ui

//= require jquery-ui

or downgrade the jquery-ui gem version

gem 'jquery-ui-rails', '~> 4.2.1'

1 Comment

This is also a good temporary fix for ActiveAdmin for the jquery-ui-rails 5.0 incompatibility until the pull requests are implemented. github.com/gregbell/active_admin/issues/3250
5

Downgrading from jquery-ui-rails 5.0.0 to 4.2.1 fixed it for me.

1 Comment

File names have changed in jquery-ui-rails 5 - use //= require jquery-ui/all instead
1

Just to add to this: I had the same issue, I finally solved it by placing //= require turbolinks before the jquery requirements in application.js:

//= require turbolinks
//= require jquery
//= require jquery.ui.datepicker
//= require jquery_ujs
//= require_tree .

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.