我正在使用Rails版本3.2.13和Ruby 2.0.0来研究敏捷Web开发书,但是在尝试访问localhost:3000
时,我始终收到以下错误消息:Sprockets::FileNotFound in Store#index
couldn't find file 'jquery' (in /Users/.../app/assets/javascripts/application.js:13)
我的application.js
文件:
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// ...
//
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require_tree .
在我的
Gemfile
中,我有gem 'jquery-rails', '~> 2.3.0'
,并尝试了许多我在互联网上找到的不同解决方案,但无济于事。 最佳答案
我知道了。
gem 'jquery-rails', "~> 2.3.0"
放入Gemfile。 rm Gemfile.lock
删除Gemfile.lock。 bundle install
//= require jquery-ui
在application.js中注意:如果第3步不起作用,请通过终端运行
sudo gem install jquery-rails -v 2.3.0
。关于jquery - 在Rails项目中找不到文件 'jquery',我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17285873/