jquery-ui gem:未找到或无法读取要导入的文件:jquery-ui/autocomplete
jquery-ui gem: File to import not found or unreadable: jquery-ui/autocomplete
在开发中,我无法弄清楚如何使 jquery-ui gem 变得可用。
我在项目 Gemfile 中包含 gem,键入 bundle install
,更新 app/assets/stylesheets/application.scss
以包含以下行:
@import "jquery-ui/autocomplete";
最后 app/assets/javascripts/application.js
有一行:
//= require jquery-ui/autocomplete
大致如https://github.com/joliss/jquery-ui-rails
中所述
当我尝试加载开发中的页面时,rails 抱怨说
File to import not found or unreadable: jquery-ui/autocomplete.
Load paths:
/home/dm/contra/app/assets/images
/home/dm/contra/app/assets/javascripts
/home/dm/contra/app/assets/stylesheets
/home/dm/contra/vendor/assets/javascripts
/home/dm/contra/vendor/assets/stylesheets
/home/dm/.rvm/gems/ruby-2.2.1/gems/jquery-rails-4.0.5/vendor/assets/javascripts
/home/dm/.rvm/gems/ruby-2.2.1/gems/coffee-rails-4.1.0/lib/assets/javascripts
/home/dm/.rvm/gems/ruby-2.2.1/gems/angularjs-rails-1.4.8/vendor/assets/javascripts
/home/dm/.rvm/gems/ruby-2.2.1/gems/bootstrap-sass-3.3.6/assets/stylesheets
...
下面是 jquery-ui-gem 在这台机器上的目录布局:
~/.rvm/gems/ruby-2.2.1/gems/jquery-ui-rails-5.0.5/
的内容
app Gemfile History.md lib License.txt Rakefile README.md VERSIONS.md
~/.rvm/gems/ruby-2.2.1/gems/jquery-ui-rails-5.0.5/app/assets/javascripts/jquery-ui
的内容
accordion.js datepicker-da.js datepicker-fr-CH.js datepicker-ka.js datepicker-nn.js datepicker-ta.js effect-bounce.js effect-transfer.js
autocomplete.js datepicker-de.js datepicker-fr.js datepicker-kk.js datepicker-no.js datepicker-th.js effect-clip.js menu.js
button.js datepicker-el.js datepicker-gl.js datepicker-km.js datepicker-pl.js datepicker-tj.js effect-drop.js mouse.js
core.js datepicker-en-AU.js datepicker-he.js datepicker-ko.js datepicker-pt-BR.js datepicker-tr.js effect-explode.js position.js
datepicker-af.js datepicker-en-GB.js datepicker-hi.js datepicker-ky.js datepicker-pt.js datepicker-uk.js effect-fade.js progressbar.js
datepicker-ar-DZ.js datepicker-en-NZ.js datepicker-hr.js datepicker-lb.js datepicker-rm.js datepicker-vi.js effect-fold.js resizable.js
datepicker-ar.js datepicker-eo.js datepicker-hu.js datepicker-lt.js datepicker-ro.js datepicker-zh-CN.js effect-highlight.js selectable.js
datepicker-az.js datepicker-es.js datepicker-hy.js datepicker-lv.js datepicker-ru.js datepicker-zh-HK.js effect.js selectmenu.js
datepicker-be.js datepicker-et.js datepicker-id.js datepicker-mk.js datepicker-sk.js datepicker-zh-TW.js effect-puff.js slider.js
datepicker-bg.js datepicker-eu.js datepicker-is.js datepicker-ml.js datepicker-sl.js dialog.js effect-pulsate.js sortable.js
datepicker-bs.js datepicker-fa.js datepicker-it-CH.js datepicker-ms.js datepicker-sq.js draggable.js effect-scale.js spinner.js
datepicker-ca.js datepicker-fi.js datepicker-it.js datepicker-nb.js datepicker-sr.js droppable.js effect-shake.js tabs.js
datepicker-cs.js datepicker-fo.js datepicker-ja.js datepicker-nl-BE.js datepicker-sr-SR.js effect.all.js effect-size.js tooltip.js
datepicker-cy-GB.js datepicker-fr-CA.js datepicker.js datepicker-nl.js datepicker-sv.js effect-blind.js effect-slide.js widget.js
我在这里做错了什么?
您似乎在关注错误的 README 文件。您正在阅读的是 Rails 5.0 及更高版本。
对于 5.0 之前的 Rails 版本,请遵循此文档 - https://github.com/joliss/jquery-ui-rails/blob/v4.2.1/README.md
我过去一直为此苦苦挣扎。只需删除 /autocomplete 部分并将 require 和 import 保留为 jquery-ui,它将自行加载自动完成和其余部分。
让我的自动完成功能使用这个 coffeescript
jQuery -> $('#booking_product').autocomplete
来源:['']
在开发中,我无法弄清楚如何使 jquery-ui gem 变得可用。
我在项目 Gemfile 中包含 gem,键入 bundle install
,更新 app/assets/stylesheets/application.scss
以包含以下行:
@import "jquery-ui/autocomplete";
最后 app/assets/javascripts/application.js
有一行:
//= require jquery-ui/autocomplete
大致如https://github.com/joliss/jquery-ui-rails
中所述当我尝试加载开发中的页面时,rails 抱怨说
File to import not found or unreadable: jquery-ui/autocomplete.
Load paths:
/home/dm/contra/app/assets/images
/home/dm/contra/app/assets/javascripts
/home/dm/contra/app/assets/stylesheets
/home/dm/contra/vendor/assets/javascripts
/home/dm/contra/vendor/assets/stylesheets
/home/dm/.rvm/gems/ruby-2.2.1/gems/jquery-rails-4.0.5/vendor/assets/javascripts
/home/dm/.rvm/gems/ruby-2.2.1/gems/coffee-rails-4.1.0/lib/assets/javascripts
/home/dm/.rvm/gems/ruby-2.2.1/gems/angularjs-rails-1.4.8/vendor/assets/javascripts
/home/dm/.rvm/gems/ruby-2.2.1/gems/bootstrap-sass-3.3.6/assets/stylesheets
...
下面是 jquery-ui-gem 在这台机器上的目录布局:
~/.rvm/gems/ruby-2.2.1/gems/jquery-ui-rails-5.0.5/
app Gemfile History.md lib License.txt Rakefile README.md VERSIONS.md
~/.rvm/gems/ruby-2.2.1/gems/jquery-ui-rails-5.0.5/app/assets/javascripts/jquery-ui
accordion.js datepicker-da.js datepicker-fr-CH.js datepicker-ka.js datepicker-nn.js datepicker-ta.js effect-bounce.js effect-transfer.js
autocomplete.js datepicker-de.js datepicker-fr.js datepicker-kk.js datepicker-no.js datepicker-th.js effect-clip.js menu.js
button.js datepicker-el.js datepicker-gl.js datepicker-km.js datepicker-pl.js datepicker-tj.js effect-drop.js mouse.js
core.js datepicker-en-AU.js datepicker-he.js datepicker-ko.js datepicker-pt-BR.js datepicker-tr.js effect-explode.js position.js
datepicker-af.js datepicker-en-GB.js datepicker-hi.js datepicker-ky.js datepicker-pt.js datepicker-uk.js effect-fade.js progressbar.js
datepicker-ar-DZ.js datepicker-en-NZ.js datepicker-hr.js datepicker-lb.js datepicker-rm.js datepicker-vi.js effect-fold.js resizable.js
datepicker-ar.js datepicker-eo.js datepicker-hu.js datepicker-lt.js datepicker-ro.js datepicker-zh-CN.js effect-highlight.js selectable.js
datepicker-az.js datepicker-es.js datepicker-hy.js datepicker-lv.js datepicker-ru.js datepicker-zh-HK.js effect.js selectmenu.js
datepicker-be.js datepicker-et.js datepicker-id.js datepicker-mk.js datepicker-sk.js datepicker-zh-TW.js effect-puff.js slider.js
datepicker-bg.js datepicker-eu.js datepicker-is.js datepicker-ml.js datepicker-sl.js dialog.js effect-pulsate.js sortable.js
datepicker-bs.js datepicker-fa.js datepicker-it-CH.js datepicker-ms.js datepicker-sq.js draggable.js effect-scale.js spinner.js
datepicker-ca.js datepicker-fi.js datepicker-it.js datepicker-nb.js datepicker-sr.js droppable.js effect-shake.js tabs.js
datepicker-cs.js datepicker-fo.js datepicker-ja.js datepicker-nl-BE.js datepicker-sr-SR.js effect.all.js effect-size.js tooltip.js
datepicker-cy-GB.js datepicker-fr-CA.js datepicker.js datepicker-nl.js datepicker-sv.js effect-blind.js effect-slide.js widget.js
我在这里做错了什么?
您似乎在关注错误的 README 文件。您正在阅读的是 Rails 5.0 及更高版本。
对于 5.0 之前的 Rails 版本,请遵循此文档 - https://github.com/joliss/jquery-ui-rails/blob/v4.2.1/README.md
我过去一直为此苦苦挣扎。只需删除 /autocomplete 部分并将 require 和 import 保留为 jquery-ui,它将自行加载自动完成和其余部分。
让我的自动完成功能使用这个 coffeescript
jQuery -> $('#booking_product').autocomplete 来源:['']