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

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

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

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

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Bootstrap

BootstrapはウェブサイトデザインやUIのWebアプリケーションを素早く 作成する可能なCSSフレームワークです。 Twitter風のデザインを作成することができます。

CSS

CSSはXMLやHTMLで表現した色・レイアウト・フォントなどの要素を指示する仕様の1つです。

Q&A

1回答

440閲覧

herokuでRailsアプリのスタイルが効かない

mttkd399

総合スコア13

Ruby on Rails 5

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

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Bootstrap

BootstrapはウェブサイトデザインやUIのWebアプリケーションを素早く 作成する可能なCSSフレームワークです。 Twitter風のデザインを作成することができます。

CSS

CSSはXMLやHTMLで表現した色・レイアウト・フォントなどの要素を指示する仕様の1つです。

0グッド

0クリップ

投稿2019/01/10 16:56

前提・実現したいこと

簡単なRailsアプリをherokuにデプロイする。
=>デプロイはできるがbootstrapやcssが効かない。

↓app/assets/javascript/application.js↓

js

1//= require rails-ujs 2//= require jquery 3//= require bootstrap-sprockets 4//= require activestorage 5//= require turbolinks 6//= require_tree . 7

↓app/assets/stylesheet/application.scss↓

scss

1@import "bootstrap-sprockets"; 2@import "bootstrap"; 3 4.hogehoge { 5 something... 6}

発生している問題・エラーメッセージ

開発環境では正しく表示できるが、heroku上でスタイルがうまく当たらない

該当のソースコード

↓herokuデプロイ時のログ↓

Counting objects: 5, done. Delta compression using up to 8 threads. Compressing objects: 100% (5/5), done. Writing objects: 100% (5/5), 498 bytes | 498.00 KiB/s, done. Total 5 (delta 3), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Ruby app detected remote: -----> Compiling Ruby/Rails remote: -----> Using Ruby version: ruby-2.4.0 remote: -----> Installing dependencies using bundler 1.15.2 remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment remote: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.17.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. remote: Fetching gem metadata from https://rubygems.org/...... ...... remote: Bundle completed (3.53s) ... remote: -----> Installing node-v10.14.1-linux-x64 remote: -----> Detecting rake tasks remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: Yarn executable was not detected in the system. remote: Download Yarn at https://yarnpkg.com/en/docs/install remote: Asset precompilation completed (1.83s) remote: Cleaning assets remote: Running: rake assets:clean remote: -----> Detecting rails configuration remote: remote: ###### WARNING: remote: remote: You set your `config.active_storage.service` to :local in production. remote: If you are uploading files to this app, they will not persist after the ... remote: remote: remote: ###### WARNING: remote: remote: We detected that some binary dependencies required to ... remote: remote: remote: ###### WARNING: remote: remote: No Procfile detected, using the default web server. ... remote: remote: remote: -----> Discovering process types remote: Procfile declares types -> (none) remote: Default types for buildpack -> console, rake, web remote: remote: -----> Compressing... remote: Done: 61.7M remote: -----> Launching... remote: Released v19 remote: https://myapp/ deployed to Heroku remote: remote: Verifying deploy... done.

試したこと

app/config/initializer/assets.rbに以下を追記

Rails.application.config.assets.precompile += %w( *.js *application.css )

補足情報(FW/ツールのバージョンなど)

Rails-v => 5.2.2
Ruby-v => 2.4.0

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

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

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

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

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

guest

回答1

0

ローカルでできていてHerokuでできないのでしたら最新のコミットができているか確認してみてください。

投稿2019/03/12 08:55

ykp_yk

総合スコア654

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

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

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

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問