11

I'm working through the Agile Web Development book with Rails version 3.2.13 and Ruby 2.0.0, but I keep getting the following error when trying to access localhost:3000:

Sprockets::FileNotFound in Store#index

couldn't find file 'jquery' (in /Users/.../app/assets/javascripts/application.js:13)

My application.js file:

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

In my Gemfile, I have gem 'jquery-rails', '~> 2.3.0' and have attempted many different solutions I found on the internet to no avail.

4

3 回答 3

16

我让它工作。

  1. 放入gem 'jquery-rails', "~> 2.3.0"Gemfile。
  2. 通过在终端中键入来删除 Gemfile.lock rm Gemfile.lock
  3. bundle install从终端运行
  4. 确保//= require jquery-ui在 application.js 中

注意:如果步骤 3 不起作用,则sudo gem install jquery-rails -v 2.3.0通过终端运行。

于 2013-06-24T22:27:44.337 回答
0

此外,如果您在 OS X 上使用POW,那么您可能需要重新启动您的应用程序

touch tmp/restart.txt
于 2014-09-22T17:23:45.590 回答
0

这可能很愚蠢,但重新启动服务器对我有用,它会记住库。

于 2018-02-25T14:16:24.363 回答