Deekor
Deekor

Reputation: 9499

Rails 5: Sprockets::FileNotFound - couldn't find file 'jquery-ui/autocomplete' with type 'application/javascript'

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

Upvotes: 8

Views: 3225

Answers (3)

W4rQCC1yGh
W4rQCC1yGh

Reputation: 2219

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 :/

Upvotes: 0

Shiny
Shiny

Reputation: 121

change the line in application.js

from

//= require jquery-ui/autocomplete

to

 //= require jquery-ui/widgets/autocomplete

Upvotes: 6

Deekor
Deekor

Reputation: 9499

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.

Upvotes: 2

Related Questions