I have upgraded an exsisting rails version 6.1 to 7.1.3 where i have used
sprocket-rails gem
to work out the exsisting asset piple. after running the command bundle exec rake assets:precompile
, i am getting the following error, including an error. What am I doing wrong? All help is much appreciated! I am new to Rails. Thanks.
bundle exec rake assets:precompile
rake aborted!
Sprockets::FileNotFound: couldn't find file 'jquery-1.7' with type 'application/javascript' (Sprockets::FileNotFound)
Checked in these paths:
/Users/rabeyakhatunmuna/Documents/expertiger-app/app/assets/config
/Users/rabeyakhatunmuna/Documents/expertiger-app/app/assets/files
/Users/rabeyakhatunmuna/Documents/expertiger-app/app/assets/images
/Users/rabeyakhatunmuna/Documents/expertiger-app/app/assets/javascripts
/Users/rabeyakhatunmuna/Documents/expertiger-app/app/assets/stylesheets
/Users/rabeyakhatunmuna/Documents/expertiger-app/lib/assets/expertiger-font
/Users/rabeyakhatunmuna/Documents/expertiger-app/vendor/assets/fonts
/Users/rabeyakhatunmuna/Documents/expertiger-app/vendor/assets/images
/Users/rabeyakhatunmuna/Documents/expertiger-app/vendor/assets/javascripts
/Users/rabeyakhatunmuna/Documents/expertiger-app/vendor/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/active_admin-sortable_tree-2.1.0/app/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/active_admin-sortable_tree-2.1.0/app/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/active_admin-sortable_tree-2.1.0/vendor/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/active_material-1.5.2/app/assets/images
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/active_material-1.5.2/app/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/active_material-1.5.2/app/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/xdan-datetimepicker-rails-2.5.4/app/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/xdan-datetimepicker-rails-2.5.4/app/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activeadmin_addons-1.10.1/app/assets/images
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activeadmin_addons-1.10.1/app/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activeadmin_addons-1.10.1/app/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activeadmin_addons-1.10.1/vendor/assets/select2
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activeadmin-3.2.0/app/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activeadmin-3.2.0/app/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activeadmin-3.2.0/vendor/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jquery-rails-4.6.0/vendor/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/formtastic-4.0.0/app/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/doorkeeper-5.6.9/app/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/doorkeeper-5.6.9/vendor/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rails-bootstrap-markdown-2.6.0/app/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rails-bootstrap-markdown-2.6.0/app/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/twitter-bootstrap-rails-5.0.0/app/assets/fonts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/twitter-bootstrap-rails-5.0.0/app/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/twitter-bootstrap-rails-5.0.0/app/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/twitter-bootstrap-rails-5.0.0/vendor/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/momentjs-rails-2.29.4.1/vendor/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/modernizr-rails-2.7.1/vendor/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jquery-star-rating-rails-4.0.4/vendor/assets/images
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jquery-star-rating-rails-4.0.4/vendor/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jquery-star-rating-rails-4.0.4/vendor/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jquery.fileupload-rails-1.11.0/vendor/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jquery.fileupload-rails-1.11.0/vendor/legacy_assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jquery.fileupload-rails-1.11.0/vendor/legacy_assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jquery-ui-rails-5.0.5/app/assets/images
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jquery-ui-rails-5.0.5/app/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jquery-ui-rails-5.0.5/app/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/actiontext-7.1.3/app/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/actiontext-7.1.3/app/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/actioncable-7.1.3/app/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activestorage-7.1.3/app/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/actionview-7.1.3/app/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/actionview-7.1.3/lib/assets/compiled
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/turbolinks-source-5.2.0/lib/assets/javascripts
/Users/rabeyakhatunmuna/Documents/expertiger-app/node_modules
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bootstrap-sass-3.4.1/assets/stylesheets
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bootstrap-sass-3.4.1/assets/javascripts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bootstrap-sass-3.4.1/assets/fonts
/Users/rabeyakhatunmuna/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bootstrap-sass-3.4.1/assets/images
/Users/rabeyakhatunmuna/Documents/expertiger-app/app/assets/javascripts/mercury.js:10
Tasks: TOP => assets:precompile
My Gemfile
source 'https://rubygems.org'
git_source(:github) { |name| "https://github.com/#{name}.git" }
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
ruby '3.2.2'
gem 'pg', '~> 1.2', '>= 1.2.5'
gem 'rails', '7.1.3'
# gem 'jruby-pg', '1.0', :git => 'git://github.com/headius/jruby-pg.git', :branch => :master
gem 'bootsnap', require: false
gem 'rake', '>=10.1.0'
# Helpers
gem 'passenger', '~> 5'
# gem 'spork-rails', :github => 'sporkrb/spork-rails'
gem 'config_spartan'
gem 'mailsafe'
gem 'rails-i18n', '>= 5.1.2'
gem 'rollbar'
gem 'thread_safe' # has this anything to do with the logmein error?
gem 'whenever'
# gem 'rails_fix_google_bot_accept'
gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: 'a4b038c6c1b9d76dac33d5711d28aaa9b4c42c66'
gem 'rubyzip'
# HTML
gem 'bootstrap-sass', '~> 3.3'
gem 'jquery.fileupload-rails'
gem 'jquery-star-rating-rails'
gem 'kaminari', '~> 1.2', '>= 1.2.1'
gem 'kaminari-bootstrap'
gem 'modernizr-rails'
gem 'momentjs-rails', '>= 2.29.4.1'
gem 'redcarpet'
gem 'twitter-bootstrap-rails', '~> 5.0'
# gem 'html5shiv-rails'
gem 'rails-bootstrap-markdown'
gem 'rest-client'
# gem 'mercury-rails', '~> 0.9.0' #mercury edit is no more working with rails 7
gem 'datetimepicker-rails', github: 'zpaulovics/datetimepicker-rails', branch: 'master', submodules: true
gem 'recaptcha'
# API
gem 'blather', '~> 2.0.0'
gem 'geocoder'
gem 'gibbon', '~> 1.1' # mailchimp lock for Mailchimp API v2
gem 'httparty'
gem 'paymill_ruby'
gem 'paypal_nvp', '0.2.5' # rest api doesn't provide fee details
gem 'paypal-sdk-core', '0.2.7'
gem 'paypal-sdk-rest', '0.6.0'
gem 'plivohelper'
gem 'pusher', '>= 0.15.3'
gem 'redis', '~> 5.1'
gem 'savon', '~> 2.12', '>= 2.12.1'
gem 'xmlrpc', platforms: %i[ruby_24 ruby_25]
# gem 'google-adwords-api'
gem 'figo'
gem 'httpi'
gem 'zendesk_api'
# Authentication
gem 'devise', '>= 4.8'
# gem 'devise_security_extension' # Some fixes are still in the latest release 0.8.2
gem 'cancancan', '~> 1.10'
gem 'doorkeeper', '~> 5.2'
gem 'omniauth'
gem 'omniauth-facebook'
gem 'sprockets-rails'
# Functional
gem 'blz'
gem 'countries' # , '0.11.4'
gem 'double-bag-ftps'
gem 'ga_cookie_parser'
gem 'ibanizator'
gem 'net-sftp'
gem 'phony', '2.18.18'
gem 'phony_rails', '0.15.0'
gem 'request_store'
gem 'sepa_king', '~> 0.12.0'
gem 'sitemap_generator'
gem 'voight_kampff'
# Delayed jobs
gem 'sidekiq', '= 6.1.0'
gem 'sinatra', '>= 1.4.4', require: nil
# Extension
gem 'aasm'
gem 'acts-as-taggable-on', '10.0.0'
gem 'enumerize', '>= 2.4.0'
gem 'girl_friday'
gem 'simple_form', '~> 5.0.3'
gem 'watchable'
gem 'wisper'
# activeadmin
gem 'activeadmin', '~> 3.2'
gem 'activeadmin_addons'
gem 'ransack', '>= 2.6.0'
gem 'responders', '~> 3.1.0'
# gem 'inherited_resources'#, github: 'josevalim/inherited_resources', branch: 'rails-4-2'
gem 'active_admin-sortable_tree'
gem 'formtastic', '~> 4.0'
gem 'loofah', '2.21.3'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
# gem 'less-rails', '~> 5.0' # Sprockets (what Rails 3.1 uses for its asset pipeline) supports
gem 'turbolinks', '~> 5.0'
# gem 'non-stupid-digest-assets'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '>= 2.11.5'
gem 'jquery-rails'
# File storage on Amazon S3. ImageMagick must be installed
gem 'paperclip', '~> 5.2.0'
# gem 'mongoid-paperclip', :require => 'mongoid_paperclip'
gem 'aws-sdk', '~> 2.6'
gem 'cocaine'
# Jcrop branch with Rails 4 support
# gem 'jcrop-rails', github: 'DariuszMichalski/jcrop-rails'
# Identify a users browser
gem 'text'
gem 'user_agent_parser'
# Bill PDF generation
gem 'pdfkit'
gem 'wkhtmltopdf-binary'
# Gems used only for assets and not required
# in production environments by default.
# group :assets do
# gem 'coffee-rails', '>= 5.0.0'
# gem 'libv8'
# gem 'sass-rails', '~> 6.0'
# # gem 'therubyracer'
# # gem 'therubyracer', platforms: :ruby, github: 'cowboyd/therubyracer'
# # gem 'therubyrhino'
# # See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'uglifier', '>= 1.0.3'
# end
group :development, :test do
# gem 'debase' ##debase use for debugging which can be done with gem like pry and debugger
gem 'factory_bot_rails'
gem 'faker'
gem 'guard-rspec' # , '>1.2.1'
gem 'pry', '~> 0.14.2'
gem 'rb-fsevent', '>=0.9.1', require: false
gem 'rspec-activejob'
gem 'rspec-rails', '~> 4.0.0'
gem 'rubocop', require: false
gem 'spring', '~> 3.0'
gem 'spring-commands-rspec'
gem 'yard' # documentation
end
group :development do
gem 'annotate'
gem 'better_errors'
gem 'binding_of_caller'
gem 'guard-livereload', require: false
gem 'rack-livereload'
# gem 'meta_request'
gem 'byebug'
gem 'capistrano', '> 3.0'
gem 'capistrano-bundler'
gem 'capistrano-passenger'
gem 'capistrano-rails'
gem 'capistrano-rbenv'
end
group :test do
gem 'capybara', '~> 3.5.0'
gem 'factory_girl_rails', '>=4.1.0', require: false
gem 'growl', '1.0.3'
gem 'launchy' # required for capybara's "save_and_open_page" command
gem 'simplecov', require: false
gem 'timecop'
gem 'webmock'
end
group :production do
# gem 'skylight'
end
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano', group: :development
My application.js file:
app/assets/javascripts/application.js.coffee
# 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, vendor/assets/javascripts,
# or vendor/assets/javascripts of plugins, if any, 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.
#
# WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
# GO AFTER THE REQUIRES BELOW.
#
#= require common/rollbar
#= require jquery
#= require common/rollbar-jquery
#= require jquery_ujs
#= require lib/extensions
#= require turbolinks
#= require pusher-2.2.4
#= require jquery.fileupload
#= require jquery-ui/slider
#= require jquery-ui/autocomplete
#= require jquery.autosize
#= require modernizr
#= require moment
#= require moment/de.js
#= require Chart
#= require bootstrap-sprockets
#= require bootstrap-markdown
#= require bootstrap-inputmask
#= require configuration
#= require ace/ace
#= require ace/ace-elements
#= require ace/bootstrap-tag
#= require common/expertiger
#= require common/pusher-helper
#= require_tree ./common
#= require_tree ./application
app/assets/stylesheets/application.scss
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
**/
/* ...
*= require jquery-ui/slider
*= require jquery-star-rating
*= require application/bootstrap_and_overrides
*/
application.html.erb
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<%= render 'layouts/application/head' %>
<%= content_tag :body, :id => page_id, class: 'no-skin ' + params[:controller], data: { roles: current_visitor.roles, name: current_visitor.try(:name) }.merge(@page_data || {}) do %>
<div id="progressBar" class="waiting">
<dt></dt>
<dd></dd>
</div>
<div>
<%= render 'layouts/application/header' %>
<div class="main-container">
<% if current_visitor.is(:supporter) %>
<%= render 'layouts/application/sidebar_supporter' %>
<% elsif current_visitor.is(:user) %>
<%= render 'layouts/application/sidebar_user' %>
<% else %>
<%= render 'layouts/application/sidebar_guest' %>
<% end %>
<div class="main-content">
<div class="main-content-inner" style="border-top: 1px solid #cccccc;">
<div class="page-content" style="position: relative;">
<%= content_for :page_title %>
<div class='flash-content'>
<%= bootstrap_flash %>
</div>
<%= yield %>
</div>
</div>
</div>
</div>
</div>
<%= render_safe 'layouts/application/news_modal' %>
<%= render 'layouts/application/footer' %>
<% if current_visitor.is(:supporter) %>
<div data-channel-names="<%= pusher_channel_names(current_user) %>"></div>
<% end %>
<div id="supporter_chat_messages"></div>
<div id="fb-root"></div>
<% end %> <!-- body -->
</html>
I want the sprocket works properly to import the asset pipeline. Since the project is already in live, i can not change the exsisting styling code. Need to setup and configue sprocket properly sothat asset pipeline works properly.
2
Answers
you have to remove javascript include tag from all the site
I would refactor javascript with best practice for rails 7.1
If you still would like to use jQuery with rails 7.1 I would try to place jQuery in javascript under assets folder and include it in application.js (or coffee in your case) to see if it will fetch that.
Also, I noticed jquery-rails gem has some notes:
I would recommend replacing jquery-ujs with rails-ujs for debugging purpose and after that place jQuery1.17 to your assist as I mention earlier
Please also check https://github.com/rails/sprockets-rails