Surender Thillainathan
Surender Thillainathan

Reputation: 716

Sprockets::FileNotFound in Roles#index couldn't find file 'jquery'

I'm upgrading a rails application from rails 3.2 to 4.2.0.rc2. While trying to run the Application I got this.

Screenshot of the page

Gem File

source 'https://rubygems.org'

gem 'rails', '4.2.0.rc2'
gem 'pg'
gem 'net-ldap'
gem "paperclip"
gem 'cancan'
gem "fastercsv"
gem 'csv_importer'
gem "httparty"
gem 'json'
gem 'will_paginate'
gem 'pusher'
gem 'tinymce-rails'
gem 'rubyzip'
gem 'rinku'
gem 'activerecord-session_store'
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem 'jquery-datatables-rails'
gem 'jquery-rails'
gem 'rufus-scheduler'
gem "sprockets"
gem 'jquery-ui-rails'
gem 'newrelic_rpm'

gemfile.lock

jquery-datatables-rails (3.1.1)
      actionpack (>= 3.1)
      jquery-rails
      railties (>= 3.1)
      sass-rails
    jquery-rails (4.0.0)
      rails-dom-testing (~> 1.0)
      railties (>= 4.2.0.beta, < 5.0)
      thor (>= 0.14, < 2.0)
    jquery-ui-rails (5.0.3)
      railties (>= 3.2.16)

app/views/layouts/application.html.erb

<!DOCTYPE html>
<html>
<head>


  <title>Work Room</title>
  <%= stylesheet_link_tag    "application", :media => "all" %>
  <%= javascript_include_tag "application" %>
<%#= javascript_include_tag "tinymce.min" %>
<%#= javascript_include_tag 'ckeditor/ckeditor.js' %>

    <%= puts "log" %>
    <%= puts flash[:error_text] %>
  <% if flash[:error_text] %>
  <script type="text/javascript" >
    //window.alert("You don't have permission to 'Edit/Delete' this comment");
    window.alert('<%= flash[:error_text] %>');
</script>
<% end %>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
  <%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

</body>
</html>

app/controllers/roles_controller.rb

class RolesController < ApplicationController
  # GET /roles
  # GET /roles.json

  before_action :require_login
  # load_and_authorize_resource
  load_and_authorize_resource except: [:create]

  def index
    @roles = Role.all.to_a
    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @roles }
    end
  end

  # GET /roles/1
  # GET /roles/1.json
  def show
  ...
  ...
end

application.js

....
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require_tree .
//= require tinymce.min
....

By blogging I have tried many solutions for this problem.

If I remove

//= require jquery
//= require jquery-ui
//= require jquery_ujs

these from application.js the application is running. But I need JQuery to do some manipulations.

I need some help to solve this problem.

Thank You in Advance...

Upvotes: 2

Views: 1390

Answers (1)

Surender Thillainathan
Surender Thillainathan

Reputation: 716

I just remove the Gemfile.lock by using the terminal.

rm Gemfile.lock

and then bundle install

It worked for me but I don't know why is works.

Upvotes: 2

Related Questions