[RAILS] Error in production environment (The asset "~" is not present in the asset pipeline.)

Introduction

I got an error when deploying the original app, so I'll post it so that I can easily resolve it if the same error occurs in the future.

1. Error details

When I checked the published application, the following error screen appeared. Since the cause of the error is not clear from this screen,

スクリーンショット 2021-01-08 21.52.12.png Since the cause of the error is not clear from the screen above, check the error log in the terminal.

Terminal

heroku logs --tail --app hoge-app-0123

Then, I was able to confirm that there was a problem in the following part. スクリーンショット 2021-01-08 21.46.25.png

What I looked up

Google Translate the error log says "Asset" icon_noimage "does not exist in the asset pipeline. Was translated.

Searching the net because the asset pipeline was unknown → The function to concatenate and compress the files in the assets directory divided into multiple directories and files has appeared. → Does it mean that icon_noimage does not exist and is not connected? ?? ?? Hmm, I don't know ...

Find out more solutions ...

To error resolution

I was able to solve it by changing config.assets.compile in config/envitonments/production.rb from false to true. It seems to be used when the layout collapses in the production environment.

config/envitonments/production.rb


config.assets.compile = true

Finally

Even if there is no problem in the local environment, problems may occur in the production environment, so it has been said for a long time to deploy frequently, but I realized the meaning. In addition, I was able to realize that I lacked knowledge of system terms due to this error, so I would like to continue learning.

Reference article

TRANSNET column "Rails beginners can easily trip over the" asset pipeline "" https://www.transnet.ne.jp/2016/02/28/rails%E5%88%9D%E5%AD%A6%E8%80%85%E3%81%8C%E3%81%A4%E3%81%BE%E3%81%9A%E3%81%8Dcolnr%E3%80%8C%E3%82%A2%E3%82%BB%E3%83%83%E3%83%88%E3%83%91%E3%82%A4%E3%83%97%E3%83%A9%E3%82%A4%E3%83%B3/

Recommended Posts

Error in production environment (The asset "~" is not present in the asset pipeline.)
[Error] The app is not displayed in the production environment
[Rails] About the error that the image is not displayed in the production environment
Image is not displayed in production environment
How to resolve the error'ActionView :: Template :: Error (The asset "application.css" is not present in the asset pipeline.'" When precompiling Rails assets
I get Mysql2 :: Error :: ConnectionError in the production environment
The repository ... is not signed error in docker build apt-get update
[Rails] Reset the database in the production environment
Display the background image in the production environment
The devise error message is not displayed properly.
500 Internal Server Error occurs in Rails production environment
When the project is not displayed in eclipse
Ebean.update () is not executed in the inherited model.
(Capistrano) After deploying, I get a We're sorry… error in the production environment.
About the asset pipeline
A solution to an error that makes you angry that you are not following the MySQL default setting ONLY_FULL_GROUP_BY in a production environment and it is not unique.
"tx" is not bound error
The idea of cutting off when the error is not resolved
I want to display the images under assets/images in the production environment
[Rails] How to reset the database in production environment (Capistrano version)
ERROR: In file ./.env: environment variable name'THOR_SILENCE_DEPRECATION' may not contain whitespace.
Create a database in a production environment
Error in ./gradlew: Symbol not found
Data is not registered in Rails.
Pay.JP Solution when it can be done locally but it does not work well in the production environment
Puma --Nignx is an escape route when rails s -e production -d doesn't work in the environment
What to do if the prefix c is not bound in JSP
Error when the member of Entity class used in SpringWebFlux is final
[Cloud9] Yay! You ’re on Rails! Is not displayed in the rails tutorial
If rbenv install is not successful, try using the environment variable "RUBY_BUILD_CURL_OPTS".
If the JDK version is correct in Eclipse but an error occurs or the compiler does not work properly
Spring Autowired is written in the constructor
How to reflect seeds.rb in production environment
must not return in the for statement
What is the main method in Java?
Creating a Servlet in the Liberty environment
Add if not in Set, error message if
Possibility when deploying to EC2 but nothing is displayed in the error log
When nginx conf is not reflected well in AWS Elastic Beanstalk + Rails environment
[Ruby On Rails] Error in test using RSpec MySQL client is not connected
How to set when "The constructor Empty () is not visible" occurs in junit
The list of installed apps is not displayed in getPackageManager (Android11 ​​/ API level 30)
Is it mainstream not to write the closing tag of <P> tag in Javadoc?