Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
80 views
in Technique[技术] by (71.8m points)

php - icons,images & javascript files missing from frontend after applying update command in magento 2.4.1?

I've installed the magento v2.4.1 by downloading and uploading the zip file content and apply simple commands to install the magento.

I'm new to magento and don't understand much, So please read through the below and I've tried my best to explain the issue.

Use the below command to install magento:

php magento setup:install

I got the following message:

[Progress: 1347 / 1347]
[SUCCESS]: Magento installation complete.
[SUCCESS]: Magento Admin URI: /admin_1d6ja1

After installation, I've found images,icon and javascript files went missing.

So I tried to look at this guide but wasn't able to understand that what I've to do here? stylesheet&images missing Magento guide

so I found a way from here Magento Stackexchange to get back my missing stylesheet files & this solution works well.

Now, the problem is whenever I try to apply below commands to magento then I'll start missing of images, stylesheets and JS.

php magento setup:upgrade

So what I want is to get permanent fix of this issue and don't want to apply the missing stylesheet patch up commands to fix every time, I apply update or upgrade command.

To get back all the images and javsacript or theme related files I have to always apply commands in below manner once I upgrade or compile my code:

php magento setup di:compile
php magento setup:upgrade
php magento setup:static-content:deploy -f
php magento cache:flush
php magento indexer:reindex

If I don't apply some of the above commands my theme seems broken.:( So how to fix this issue that my theme won't break after applying compile or upgrade commands???

enter image description here

question from:https://stackoverflow.com/questions/65950780/icons-images-javascript-files-missing-from-frontend-after-applying-update-comm

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you are in production mode, and are running setup:upgrade and you don't want regenerate static content because there is no need to, then you can use the following:

php bin/magento setup:upgrade --keep-generated

--keep-generated is an optional argument that does not update static view files. It should be used only in production mode. It should not be used in developer mode.

https://devdocs.magento.com/guides/v2.4/install-gde/install/cli/install-cli-subcommands-db-upgr.html#instgde-cli-db-upgr


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...