LoginSignup
0
1

More than 3 years have passed since last update.

デプロイ後にjsが動かない件

Posted at

環境

サーバサイド
ruby 2.5.7
rails 5.2.4
本番サーバ環境
AWS(EC2,RDS,EIP)

出たエラー

デプロイ後プリコンパイルをしたのにRailsアプリケーションのエラーが出て正しくページが表示されなかったため、確認。

ターミナル
$ sudo tail -f log/production.log

上記のコマンドでRailsのエラーログを表示。
タララララーっとエラーが出てきた中に下記のようなエラーを発見

ターミナル
(略)
F, [……] ActionView::Template::Error (The asset "〇〇.js" is not present in the asset pipeline.):
(略)

(jsがうまく読み込めてないのだな…)
下記の作業を行う。

ターミナル
$ vi config/environments/production.rb 

↑これの最後の行のendの前に

config.assets.precompile += ['〇〇.js’]

を入れる。

rails再起動

ターミナル
$ kill $(cat tmp/pids/puma.pid)
$ rails s -e production

jsが読み込まれましたとさ:relaxed:

おしまい

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1