質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

0回答

2045閲覧

Ruby on RailsでBootstrapが使用できない

machidai

総合スコア15

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

2クリップ

投稿2019/04/28 17:03

RailsにBootstrapを導入しようとして何度やり直してもエラーになってしまうのでどなたかアドバイス頂ければと思い投稿させていただきました。

環境はドットインストールをみてVagrant環境で行っております。

環境
・windows10
・Rails 5.2.3
・ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
・Vagrant

error

1Sprockets::FileNotFound in Posts#index 2Showing /home/vagrant/ruby/myblog/app/views/layouts/application.html.erb where line #8 raised: 3 4couldn't find file 'jquery3' with type 'application/javascript' 5Checked in these paths: 6 /home/vagrant/ruby/myblog/app/assets/config 7 /home/vagrant/ruby/myblog/app/assets/images 8 /home/vagrant/ruby/myblog/app/assets/javascripts 9 /home/vagrant/ruby/myblog/app/assets/stylesheets 10 /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/coffee-rails-4.2.2/lib/assets/javascripts 11 /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actioncable-5.2.3/lib/assets/compiled 12 /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activestorage-5.2.3/app/assets/javascripts 13 /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionview-5.2.3/lib/assets/compiled 14 /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/turbolinks-source-5.2.0/lib/assets/javascripts 15 /home/vagrant/ruby/myblog/node_modules 16 /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bootstrap-4.0.0/assets/stylesheets 17 /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bootstrap-4.0.0/assets/javascripts 18Extracted source (around line #13): 19// about supported directives. 20// 21//= require jquery3 22//= require jquery-ui/widgets/datepicker 23//= require popper 24//= require bootstrap-sprockets 25 26// about supported directives. 27// 28//= require jquery3 29//= require jquery-ui/widgets/datepicker 30//= require popper 31//= require bootstrap-sprockets 32 33```gemfile 34```source 'https://rubygems.org' 35git_source(:github) { |repo| "https://github.com/#{repo}.git" } 36 37ruby '2.3.1' 38 39# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 40gem 'rails', '~> 5.2.1' 41# Use sqlite3 as the database for Active Record 42gem 'sqlite3' 43# Use Puma as the app server 44gem 'puma', '~> 3.11' 45# Use SCSS for stylesheets 46gem 'sass-rails', '~> 5.0' 47# Use Uglifier as compressor for JavaScript assets 48gem 'uglifier', '>= 1.3.0' 49# See https://github.com/rails/execjs#readme for more supported runtimes 50 51gem 'bootstrap', '~> 4.0.0' 52 53# Use jquery as the JavaScript library 54gem 'jquery-rails' 55# Use CoffeeScript for .coffee assets and views 56gem 'coffee-rails', '~> 4.2' 57# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 58gem 'turbolinks', '~> 5' 59# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 60gem 'jbuilder', '~> 2.5' 61# Use Redis adapter to run Action Cable in production 62# gem 'redis', '~> 4.0' 63# Use ActiveModel has_secure_password 64# gem 'bcrypt', '~> 3.1.7' 65 66gem 'therubyracer' 67gem 'autoprefixer-rails', '8.6.5' 68 69# Use ActiveStorage variant 70# gem 'mini_magick', '~> 4.8' 71 72# Use Capistrano for deployment 73# gem 'capistrano-rails', group: :development 74 75# Reduces boot times through caching; required in config/boot.rb 76gem 'bootsnap', '>= 1.1.0', require: false 77 78group :development, :test do 79 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 80 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 81end 82 83group :development do 84 # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 85 gem 'web-console', '>= 3.3.0' 86 gem 'listen', '>= 3.0.5', '< 3.2' 87 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 88 gem 'spring' 89 gem 'spring-watcher-listen', '~> 2.0.0' 90end 91 92group :test do 93 # Adds support for Capybara system testing and selenium driver 94 gem 'capybara', '>= 2.15' 95 gem 'selenium-webdriver' 96 # Easy installation and use of chromedriver to run system tests with Chrome 97 gem 'chromedriver-helper' 98end 99 100# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 101gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 102

application.css.scss

@import "bootstrap"; /* * 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, or any plugin's * vendor/assets/stylesheets directory 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 bottom of the * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS * files in this directory. Styles in this file should be added after the last require_* statement. * It is generally better to create a new file per style scope. */ .logo{ width: 200px; height: 100px; } .header-menu{ font-size: 12px; font-weight: normal; float: right; } .error{ font-size: 12px; font-weight: bold; color: tomato; }

application.js

// 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, 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. JavaScript code in this file should be added after the last require_* statement. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery3 //= require jquery-ui/widgets/datepicker //= require popper //= require bootstrap-sprockets //= require jquery_ujs //= require turbolinks //= require_tree .

よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問