我正在使用Rails版本3.2.13和Ruby 2.0.0来研究敏捷Web开发书,但是在尝试访问localhost:3000时,我始终收到以下错误消息:
Sprockets::FileNotFound in Store#indexcouldn'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/

    10-11 23:31
    查看更多