Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

couldn't find file 'jquery' #180

Closed
tdtadeu opened this issue Dec 12, 2014 · 4 comments
Closed

couldn't find file 'jquery' #180

tdtadeu opened this issue Dec 12, 2014 · 4 comments

Comments

@tdtadeu
Copy link

tdtadeu commented Dec 12, 2014

I'm trying to update the gem in a project using Rails 4.2.0.beta4, but it seems that the jquery file can't be found. I tried changing the jquery-rails version back to 3.1.2 and it works with that version, the problem does seem to be with the current version.

Playing a little in the console I found when you try to require the gem (4.0) it gives you an error, while requiring the 3.1.2 only returns false.

The error in the title happens in the <%= javascript_include_tag "application" %> line of the application layout, of course.

Here's the application.js:

//= require jquery
//= require jquery_ujs
//= require bootstrap-sprockets
//= require bootstrap
//= require slick
//= require_tree .

Gemfile, in case you need it:

source "https://rubygems.org"

ruby "2.1.4"

gem "rails", "~> 4.2.0.beta4"
gem "pg"
gem "sass-rails", "~> 5.0.0.beta1"
gem "bootstrap-sass"
gem "uglifier", ">= 1.3.0"
gem "coffee-rails", "~> 4.0.0"
gem "therubyracer",  platforms: :ruby
gem "draper", "~> 1.3"
gem "simple_form", github: "plataformatec/simple_form"
gem "dotenv-rails"
gem "devise"
gem "dynamic_form"
gem "chosen-rails"

group :assets do
  gem "asset_sync"
end

gem "jquery-rails"
gem "jbuilder", "~> 2.0"

group :development do
  gem "quiet_assets"
  gem "rspec-rails"
end

group :test, :development do
  gem "did_you_mean"
end

group :test do
  gem "capybara"
  gem "poltergeist"
  gem "simplecov", "~> 0.7.1"
  gem "factory_girl_rails"
  gem "database_cleaner"
  gem "shoulda-matchers", require: false
  gem "capybara-email"
end
@rafaelfranca
Copy link
Member

Have you tried with 4.2.0.rc2?

@rafaelfranca
Copy link
Member

I create a new application and it is working fine. It seems to be something related to your setup.

@smidwap
Copy link

smidwap commented Dec 14, 2014

I ran into the same problem. I ran rails _4.2.0rc2_ new jquery_rails_test and checked Gemfile.lock to make sure I was running jquery-rails 4.0.0. Then I created a scaffold bin/rails g scaffold posts, started the rails server, and went to localhost:3000/posts. Then I got:

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

I downgraded to jquery-rails 3.0.2, and the problem went away.

I also tried upgrading an existing app to rails 4.2.0rc2. I didn't run into any issues, since my jquery-rails version had been locked at 3.0.2. Sure enough, when I upgraded jquery-rails to 4.0.0, the error came back.

@smidwap
Copy link

smidwap commented Dec 14, 2014

Figured it out. It was a permissions problem. I ran chown where jquery-rails 4.0.0 is installed (/Library/Ruby/Gems/2.0.0/gems/jquery-rails-4.0.0) to change the owner from root to my local mac username. I restarted my Rails server, and jquery is now found.

Interestingly, root is the owner of my local jquery-rails-3.0.2 directory. I'm not sure what changed in 4.0.0 that made root no longer work. Maybe the removal of action_view/railtie?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants