New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Executing grunt refresh
or grunt exec:all
in production mode, leads to error "Unable to retrieve deployment version of static files from the file system."
#29570
Comments
Hi @Eddcapone. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. Please, add a comment to assign the issue:
🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
grunt refresh
or grunt exec:all
leads to error "Unable to retrieve deployment version of static files from the file system."grunt refresh
or grunt exec:all
in production mode, leads to error "Unable to retrieve deployment version of static files from the file system."
I figured out that It looks like this script is deleting the file pub/static/deployed_content.txt and so the errors Unable to retrieve deployment version of static files from the file system and Can not load static content version. are showing. So I modified the script and removed all lines where "deployedVersion" is showing. Original:
Fix:
Now if I call |
From: https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/tools/using_grunt.html PrerequisitesMake sure that you set your Magento application to the developer or default mode. |
@luccame Thx. Then how are we supposed to compile our theme in production mode? |
@Eddcapone |
i believe in production we should not use grunt . Every changes need to update by ultimate commands di compile and deploy static |
But this does not compile your themes LESS files, so it makes no sense? |
The commands EDIT: 2021, this is wrong. |
It is done on php. Yes this is not logical and much slower than it could
be, but that’s what we have in magento
…On Tue, 18 Aug 2020 at 11:43 Eddcapone ***@***.***> wrote:
i believe in production we should not use grunt . Every changes need to
update by ultimate commands di compile and deploy static
The commands bin/magento setup:di:compile and bin/magento
setup:static-content:deploy are not compiling your themes LESS files, so
how are we supposed to compile the Theme without using grunt?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#29570 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOJOUK7N2L4BGQGIBRSEG3SBI5JZANCNFSM4QBKB63Q>
.
|
@Eddcapone: you can use https://github.com/baldwin-agency/magento2-module-less-js-compiler which uses nodejs to compile less code instead of php, which - in the early days of Magento was much more performant, but recently the scales have tipped. But the most important feature of that module, is that the outputted css code should be 100% the same between local development (using grunt) and production (using |
I just tested it and |
Php compiler gives a bit different result time to time, that’s the main
reason - you might see the issues that no one else see
…On Tue, 18 Aug 2020 at 13:09 Eddcapone ***@***.***> wrote:
i believe in production we should not use grunt . Every changes need to
update by ultimate commands di compile and deploy static
The commands bin/magento setup:di:compile and bin/magento
setup:static-content:deploy are not compiling your themes LESS files, so
how are we supposed to compile the Theme without using grunt?
I just tested it and bin/magento setup:di:compile acutally does compile
your Theme. It works.
But I still don't understand why grunt only works for default/developer
mode? It just makes no sense for me.
I applied my fix and I will use grunt in production, until someone gives a
valid reason why we should not use grunt in production.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#29570 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOJOUIVA2VYTDL4C6M4ZW3SBJHO3ANCNFSM4QBKB63Q>
.
|
So grunt uses the php compiler? Then which compiler is used by setup:di:compile? Is it working better than grunt compiler? |
If you want steps for a production deploy, here are the basic ones which we perform: composer install --optimize-autoloader --prefer-dist --no-dev
npm install --production # only needed if you need nodejs dependencies on your build/production server
php bin/magento deploy:mode:set --skip-compilation production
php bin/magento setup:di:compile
composer dump-autoload --optimize --no-dev
touch pub/static/deployed_version.txt # to work around an old bug https://github.com/magento/magento2/issues/6426 which is not clear if it was fixed or not yet
php bin/magento setup:static-content:deploy --theme=Custom/theme nl_NL fr_FR en_US ... # depending on which languages you need in the frontend
php bin/magento setup:static-content:deploy --theme=Magento/backend en_US ... # depending on which languages you need in the backend
php bin/magento setup:upgrade --keep-generated These are just basic steps, we do a lot of complex other things due to how our workflow is setup, but hopefully this can put you in the correct direction 🙂 |
I made a color change in a less file of my theme and then executed I always have to call the whole set of commands to make it work:
|
That's because you start from dirty directories, Magento uses previously generated files in their SCD procedures and doesn't always overwrite them. If you start from a clean environment (like we always do with every single new deploy to production) it should work. In your case, please try removing these files before running
(the |
I see thank you. I just tried That worked. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions! |
Preconditions (*)
Steps to reproduce (*)
pub
your project rootphp bin/magento deploy:mode:set production
grunt exec:all
Expected result (*)
Actual result (*)
pub/static/deployed_version.txt
gets deleted.This error is getting logged:
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
The text was updated successfully, but these errors were encountered: