Levi Walsh
Levi Walsh

Reputation: 41

couldn't find file 'bootstrap' with type 'application/javascript'

I am watching the old One Month Ruby on Rails lectures without being enrolled in the course and encountered this problem. I have searched through about 20 stackoverflow and github tutorials and can't find the problem, any help is greatly appreciated. (This is my first time posting here so if I am doing something wrong or need to include more information let me know).

Gemfile:

source 'https://rubygems.org'

gem 'rails', '4.2.6'
gem 'jquery-rails'
# Use sqlite3 as the database for Active Record
group :production do
    gem 'pg'
end

group :development, :test do
    gem 'sqlite3'
end

group :assets do    
    gem 'uglifier', '>= 1.3.0'
    gem 'coffee-rails', '~> 4.1.0'
    gem 'bootstrap-sass', '~> 3.3.6'
    gem 'sass-rails', '>= 3.2'
end

Styles.css.scss :

@import "bootstrap";

application.js :

//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap
//= require_tree .

Upvotes: 1

Views: 7265

Answers (3)

Aleksey Deryagin
Aleksey Deryagin

Reputation: 2675

Remove group "assets" from Gemfile. It is obsolete in Rails 4.

Rails 4.0 removed the assets group from Gemfile. You'd need to remove that line from your Gemfile when upgrading.

See Ruby on Rails Guides

Upvotes: 2

Bilal Maqsood
Bilal Maqsood

Reputation: 1246

According to the Question its clearly stated that you need to restart your server whenever a gem is installed or updated, if you upgrade ruby, or if you change some logic that runs during boot time (like config/boot.rb or config/database.yml). Otherwise it's generally ok not to, even if you edit/add models/controllers.

Upvotes: 2

Tejas
Tejas

Reputation: 186

you use gem bootstrap-sass than in your application.js use

//= require bootstrap-sprockets

and in your application.css use

// "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables"
@import "bootstrap-sprockets";
@import "bootstrap";

Upvotes: 1

Related Questions