couln't find file 'chosen-jquery' error during deploy - ruby-on-rails

I am trying to deploy an app in rails 3.2.16, with capistrano on a vps. This is my first time doing that. During the deployment process, I get the following error: "couldn't find file "chosen-jquery" '. The rpoblem is that my gem versions and generally the whole environment is the same on the server and my testing machine. I get the error during the "assets:precompile" command execution.
Any suggestions?
I am using the gem chosen -v 1.0.2, rails 3.2.16 and Ruby 1.9.3.
Here is my gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.16'
gem 'mysql2'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'ckeditor', '4.0.4'
gem 'carrierwave', '0.8.0'
gem 'devise', '2.2.3'
gem 'globalize3', '0.3.0'
gem 'babosa', '0.3.9'
gem 'haml', '4.0.4'
gem 'friendly_id', '4.0.9'
gem 'simple_form', '2.0.4'
gem 'kaminari', '0.14.0'
gem 'nokogiri', '1.6.1'
gem 'jquery-fileupload-rails', '0.4.0'
gem 'ancestry', '1.3.0'
gem 'ransack', '0.7.2'
gem 'simple-navigation', '3.10.0'
gem 'mime-types', '~>1.21'
gem 'mini_magick', '3.5.0'
gem 'acts_as_list', '0.1.9'
gem 'chosen-rails'
gem 'pry'
gem 'passenger'
and my application.js manifest:
//= require jquery-1.10.2.min
//= require jquery_ujs
//= require ckeditor/init
//= require jquery.fancybox-1.3.4.pack
//= require jquery.easing-1.3.pack
//= require jquery.mousewheel-3.0.4.pack
//= require chosen-jquery
//= require scripts
//= require admin_scripts
Thank you in advance for your time and effort :)

You can try require the library manually (as file)

Just restart rails server. I had the same problem on Rails 4.1.5. I restarted rails server and it worked. See this Github issue

Related

ActionView::Template::Error (couldn't find file )

I've updated my app to rails 5.1 and spree to spree 3.5 this caused several problems with the latest being.
ActionView::Template::Error (couldn't find file 'jquery.validate/jquery.validate.min' with type 'application/javascript'
I've tried installing the gems like gem 'jquery-rails' gem 'rails-ujs,'~> 0.1.0' gem "jquery-ui-rails" gem 'jquery-validation-rails' and even added the files to my JavaScript folder.
Still no succes.
Anyone know the cause of the problem and how to solve it?
gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails'
# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
gem 'pg', '< 1'
# Use SCSS for stylesheets
gem 'sass-rails'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
gem 'truncate_html', '~> 0.9.3'
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'rails-ujs', '~> 0.1.0'
gem "jquery-ui-rails"
gem 'jquery-validation-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', group: :doc
gem 'rake'
gem 'rspec'
gem 'kramdown'
gem 'thor', '0.19.1'
gem 'spree_braintree_vzero', github: 'spree-contrib/spree_braintree_vzero'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'capistrano-passenger'
gem 'capistrano-rails'
gem 'capistrano-rvm'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
gem 'spree', '~> 3.5.0.rc2'
gem 'spree_auth_devise', '~> 3.3'
gem 'spree_gateway', '~> 3.3'
gem 'devise'
gem 'materialize-sass'
gem 'active_link_to'
#gem 'mollie-api-ruby', '< 3.2'
# gem 'spree_mollie', github: 'salman15/mollie_spree_2017', branch: 'stable'
#gem 'spree_mollie', github: 'ttcremers/spree_mollie', branch: 'stable'
gem 'spree_mail_settings', github: 'spree-contrib/spree_mail_settings'
# gem 'spree_i18n', github: 'spree-contrib/spree_i18n'
# gem 'spree_globalize', github: 'spree-contrib/spree_globalize', branch: 'master'
gem "mini_magick"
gem 'spree_mollie_gateway'
# gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'rails-4-x' # For 4.x
# gem 'globalize', '~> 5.1.0'
all.js/application.js
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require jquery.validate
//= require spree/frontend
//= require_tree .
//= require spree/frontend/spree_auth
//= require spree/frontend/spree_braintree_vzero
This fixed the problem for me: I just removed the line
//= require jquery.validate/jquery.validate.min
from frontend.js

How to disable Turbolinks on Heroku?

First, I removed gem 'turbolinks' and removed the code requiring Turbolinks in the application.js file. So, I successfully disabled Turbolinks in my local machine. Then, I pushed my changes to Heroku, but Turbolinks is still working in production.
How can I disable Turbolinks in Heroku?
When I ran this code:
heroku run cat app/assets/javascripts/application.js
I got following code:
//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 any plugin's vendor/assets/javascripts directory 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.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require jquery-ui/effects/effect-highlight
//= require bootstrap
//= require material
//= require materialize-sprockets
//= require custom
//= require cocoon
//= require underscore
//= require_tree .
Also, my Gemfile looks like this on the production environment:
source 'https://rubygems.org'
gem 'rails', '4.2.2'
gem 'bcrypt', '3.1.7'
gem 'faker', '1.4.2'
gem 'carrierwave', '0.10.0'
gem 'mini_magick', '3.8.0'
gem 'fog', '1.36.0'
gem 'will_paginate', '3.0.7'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'bootstrap-sass', '3.2.0.0'
gem 'sass-rails', '5.0.6'
gem 'uglifier', '2.5.3'
gem 'materialize-sass'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
gem 'omniauth-facebook'
gem 'figaro'
gem 'material_design_lite-sass'
gem 'material_icons'
gem "font-awesome-rails"
gem 'cocoon'
gem 'simple_form'
gem 'jquery-ui-rails'
gem 'activerecord-reset-pk-sequence'
gem 'underscore-rails'
group :development, :test do
gem 'sqlite3', '1.3.9'
gem 'byebug', '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
gem "better_errors"
gem "binding_of_caller"
end
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
gem 'puma', '3.1.0'
end
I have also removed all Turbolinks references in application.html.erb.
But still, Turbolinks isn't being disabled in production environment. What can be the fix?
Note: Turbolinks is successfully disabled in my development environment.
Make "data-turbolinks-track" => false in file app/views/layouts/application.html.erb
Basically straight from here. It's for Rails 4, but I believe the steps are the same.
1) Remove the gem 'turbolinks' line from your Gemfile.
2) Remove the //= require turbolinks from your app/assets/javascripts/application.js .
3) Remove the two "data-turbolinks-track" => true hash key/value pairs from your app/views/layouts/application.html.erb .

Sprockets::FileNotFound couldn't find file 'jquery-fileupload/basic'

I am attempting to upload multiple pictures with jquery file upload. In my application.js file I added //= require jquery-fileupload/basic and in my Gemfile I added jquery-fileupload-rails under the assets group. This causes the error: couldn't find file jquery-fileupload/basic. I have reset my rails server and checked for spaces in application.js however the error stays. Any help would be greatly appreciated
application.js
//= require jquery
//= require jquery_ujs
//= require jquery-fileupload/basic
//= require jquery.ui.datepicker
//= require jquery.ui.tooltip
//= require jquery-ui-1.10.4.custom.min
//= require jquery.timepicker.min
//= require bootstrap/dropdown
//= require bootstrap/modal
//= require raty
//= require_tree .
gemfile
gem 'byebug', '~> 3.5.1'
gem 'rails', '4.0.3'
gem 'pg'
gem 'bootstrap-sass', '~> 3.1.1'
gem 'devise'
gem 'faker'
gem 'geocoder'
gem 'carrierwave'
gem 'mini_magick'
gem 'figaro'
gem 'state_machine'
gem 'jquery-ui-rails', '~> 4.2.1'
gem 'rails_12factor'
gem 'elasticsearch-model'
gem 'simple_form'
gem 'omniauth-facebook'
gem 'omniauth-linkedin'
gem 'omniauth'
gem 'pry-rails'
group :development, :test do
gem 'rspec-rails', '2.13.1'
gem 'quiet_assets'
# gem 'pry-debugger'
gem 'meta_request'
gem 'interactive_editor'
gem 'hirb'
gem 'quiet_assets'
gem 'awesome_print'
end
#
group :test do
gem 'selenium-webdriver', '2.35.1'
gem 'capybara', '2.1.0'
gem 'factory_girl_rails', '4.2.1'
end
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
group :assets do
gem 'jquery-ui-rails', '~> 4.2.1'
gem 'jquery-fileupload-rails'
end
put it outside the assets group and run bundle install.
btw jquery-ui-rails does not belong there either

Action Controller: Exception caught - turbolinks issue?

I am following Michael Hartl's Rails guide, and when I load localhost:3000 I get the following error messages in the browser:
Sprockets::FileNotFound in Static_pages#home
Showing /home/jonathan/Desktop/railsTut/sample_app/app/views/layouts/application.html.erb where line #6 raised:
couldn't find file 'turbolinks'
(in /home/jonathan/Desktop/railsTut/sample_app/app/assets/javascripts/application.js:16)
This is my file from the aformentioned message
// 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
// 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 jquery
//= require jquery_ujs
//= require bootstrap
//= require turbolinks
//= require_tree .
also, I am not sure if it is related, but here is my Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'bootstrap-sass', '2.1'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'jquery-rails', '2.0.2'
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.11.0'
# gem 'guard-rspec', '1.2.1'
# gem 'guard-spork', '1.2.0'
# gem 'childprocess', '0.3.6'
# gem 'spork', '0.9.2'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
group :development do
gem 'annotate', '2.5.0'
end
group :test do
gem 'capybara', '1.1.2'
gem 'factory_girl_rails', '4.2.1'
gem 'cucumber-rails', '1.2.1', :require => false
gem 'database_cleaner', '0.7.0'
# gem 'launchy', '2.1.0'
# gem 'rb-fsevent', '0.9.1', :require => false
# gem 'growl', '1.0.3'
end
group :production do
gem 'pg', '0.12.2'
end
Any help is much appreciated!
As I see, you dont have 'turbolinks' in your gemfile... just add it! :
Add gem 'turbolinks' to your Gemfile.
Run bundle install.
Add //= require turbolinks to your Javascript manifest file (usually
found at app/assets/javascripts/application.js).
Restart your
server, and you're now using turbolinks!
As RomanDev said just remove it, unless like me you were trying to get ride of turbolinks.
In which case remove //= require turbolinks from your application.js file.
It took me way too long to realize that adding turbolinks to the gemfile would fix this. I'm also going through Hartl's tutorial as a beginner (obviously).

neo4j-will_paginate gem causing rails not to start

I'm trying to implement pagination in my Rails app with the neo4j-will_paginate gem (I'm using neo4j as my database.) I followed the instructions at https://github.com/dnagir/neo4j-will_paginate#readme viz. added neo4j-will_paginate to my gemfile and required 'neo4j-will_paginate' in my config/application.rb file. I ran bundle install and tried to fire up Rails, but I got this error:
NameError: uninitialized constant Neo4j::Traversal
const_missing at org/jruby/RubyModule.java:2642
(root) at /Users/--------/.rvm/gems/jruby-1.6.7/gems/neo4j-will_paginate-0.1.0/lib/neo4j-will_paginate.rb:43
require at org/jruby/RubyKernel.java:1042
(root) at /Users/--------/.rvm/gems/jruby-1.6.7/gems/neo4j-will_paginate-0.1.0/lib/neo4j-will_paginate.rb:12
require at org/jruby/RubyKernel.java:1042
(root) at /Users/--------/Documents/code/ThreeRing/threering/config/application.rb:53
tap at org/jruby/RubyKernel.java:1787
(root) at /Users/--------/.rvm/gems/jruby-1.6.7/gems/railties-3.2.3/lib/rails/commands.rb:50
require at org/jruby/RubyKernel.java:1042
(root) at script/rails:6
Here's my Gemfile and the relevent part of my config/application.rb
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
require "neo4j"
# require "will_paginate/railtie"
require 'neo4j-will_paginate'
Here's the gemfile
source 'http://rubygems.org'
gem 'rails', '3.2.3'
gem 'neo4j', '~> 2.0.0'
gem 'jruby-openssl', '~> 0.7.7'
gem 'json', '~> 1.7.3'
gem 'jquery-rails', ' ~> 2.0.2'
gem 'haml-rails', '~> 0.3.4'
gem 'bcrypt-ruby', '~> 3.0.1', :require => 'bcrypt'
# gem 'will_paginate', ' ~> 3.0.3'
gem 'neo4j-will_paginate'
gem 'carrierwave', '~> 0.6.2'
gem 'fog', '~> 1.3.1'
gem 'mini_magick', '~> 3.4'
gem 'trinidad', '~> 1.3.5', :require => nil
gem 'nokogiri'
gem 'libxml-jruby'
gem 'sanitize'
group :development do
gem 'rspec-rails', '~> 2.10.0'
gem 'guard-rspec', '~> 1.0.0'
end
group :test do
gem 'factory_girl_rails', '~> 3.3.0'
gem 'spork', ' ~> 1.0rc'
gem 'rb-fsevent', '~> 0.9.1'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.0'
gem 'therubyrhino', '~> 1.73.4'
gem 'uglifier', '>= 1.0.3'
end
Googling the error turns up no help, and I haven't seen any similar problems whose solutions are applicable here. Any ideas of what's going wrong here? Thanks!
It is because version < 0.1.2 of neo4j-will-paginate does not work together with neo4j.rb version 2+
Try version 0.1.2 which was released today.

Resources