我剛剛爲我的Ruby on Rails應用程序安裝了jQuery UI。它運行Rails 5.我看過所有類似的帖子,但它們不適用於我的案例。未捕獲的ReferenceError:未在Rails 5的控制檯中定義jQuery
我的頁面呈現得很好,但在Chrome開發工具的控制檯,我得到這個錯誤:
我已經重新安排了的application.js文件各種方式,仍然得到同樣的錯誤。這是文件:
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
// vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery-ui
//= require rails-ujs
//= require html.sortable
//= require turbolinks
//= require_tree .
//= require popper
//= require bootstrap-sprockets
一下如果你把'// =需要其他requries前jquery'? –
@maxpleaner是的,這是原因 –