update to 2.1.1 can not deploy static content because missing deployed_version.txt,
[UnexpectedValueException]
Unable to retrieve deployment version of static files from the file system.
[UnexpectedValueException]
Unable to retrieve deployment version of static files from the file system.
[MagentoFrameworkExceptionFileSystemException]
Cannot read contents from file "/var/www/html/magento2/pub/static/deployed_version.txt" Warning!file_get_contents(/var/www/html
/magento2/pub/static/deployed_version.txt): failed to open stream: No such file or directory
I also had this issue.
@knidie as temporary solution you could just create empty file in following path: /var/www/html/magento2/pub/static/deployed_version.txt
thanks, it works great!!
Indeed, I noticed this too: https://github.com/magento/devdocs/issues/419#issuecomment-243555654
Since you can resolve it by creating an empty file, this feels like a regression bug which crept into the 2.1.1 release. Maybe you should reopen the bug and let the Magento devs comment on this if this was an intentional change or not...
I do not think that creating a blank file is a solution - more like an ugly workaround for incorrect functional logic. Would it be possible to get rid of this messages and change the behavior to
It worked for me, this file must be there, if not system stops to deploy files , as temporary solution it's just fine.
weikai chen
在 2016年9月12日,下午2:58,bery [email protected] 写道:
I do not think that creating a blank file is a solution - more like an ugly workaround for incorrect functional logic. Would it be possible to get rid of this messages and change the behavior to
check if the file exists, if yes read the version and see what needs to be done
if the file does not exist, continue with the deploy (e.g. clean, fresh deploy)
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.
@knidie: I think it's best if you re-open this ticket, since it's new and unexpected behavior introduced in Magento 2.1.1
I'm pretty sure the change in behavior was also unintentional so we can probably call it a new bug.
Even though there is a temporary workaround, that's not really enough to call this bug "fixed".
Do you agree?
Let's include some Magento support people in here, maybe they can verify this with the developers if this is a new bug or if this was actually intentional (which I don't really believe).
/cc @veloraven, @piotrekkaminski, @pboisvert, @mazhalai, ...
Thanks!
Hi @knidie,
This issue was fixed in the scope of the MAGETWO-56915 and delivered to the develop branch.
Please check if the issue is still reproducible for you on the develop branch.
Thank you
I had this problem only when I enabled signing of static files. in:
Stores->Configuration->Advanced->Developer->Static Files Setting->Yes
Turning it to No allowed it to compile, but it's not a solution as we want to use that for caching
When is 2.1.1 going to be updated / when is the next release for 2.1.2?
Seems like 2.1.1 has a lot of issues that make it basically unusable for production without hacking and patching.
@eug123 Has MAGETWO-56915 been ported to 2.1 or is it just in develop right now? If it's not ported, will we have to wait for the next patch/2.1.2?
This issue should be included in next update, but I'm not sure
On Oct 7, 2016 23:51, "Ctucker9233" [email protected] wrote:
@eug123 https://github.com/eug123 Has MAGETWO-56915 been ported to 2.1
or is it just in develop right now? If it's not ported, will we have to
wait for the next patch/2.1.2?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/magento/magento2/issues/6426#issuecomment-252357872,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AByXUdqnRWpqBW4QzwLFd6AM4P-AgXZLks5qxrDDgaJpZM4Jx-_S
.
had this issue when upgrading from magento 2.1.0 to 2.1.2
Also had this issue when upgrading from 2.1.1 to 2.1.2.
This seems a critical problem. Please consider fixing it because we can't deploy static files in some situations :( . I'm using 2.1.2.
bug present in M2 2.1.2 EE
There is a workaround for this behavior - run
php bin/magento setup:upgrade --keep-generated
Yet, be careful when running this as you have to do the cleanup on your own.
Directories to be cleaned up manually:
Also it is worth to mention that magento documentation specifically warns from doing this when magento is set to production mode.
Hi @knidie, this issue has been backported in 2.1.3, that's why I'm closing it. Feel free to reopen it if something is not working.
This issue is still alive for me at Magento 2.1.6.
Magento is in production mode and I have used bin/magento setup:upgrade
the pub/static folder was empty (just .htaccess)
After creating the deployed_version.txt it works again.
I am having the same issue.
Furthermore, creating the deployed_version.txt only partially works. Attempting to load a page in the frontend results in linked style files and images coming up 404 - it would appear that it's linking to the wrong location.
For the record, this is the default theme, "Lumo". It also breaks links to javascript files, so the site is essentially non-functional. Worse, this happens in the backend as well.
Have the same issue in production mode in CE 2.1.6. bin/magento setup:upgrade first removed the file, and later complains about it missing:
php bin/magento setup:upgrade
Cache cleared successfully
File system cleanup:
/data1/projects/trc/staging/magento2/var/generation/Composer
/data1/projects/trc/staging/magento2/var/generation/MOFX
/data1/projects/trc/staging/magento2/var/generation/MageWorx
/data1/projects/trc/staging/magento2/var/generation/Magento
/data1/projects/trc/staging/magento2/var/generation/Symfony
/data1/projects/trc/staging/magento2/var/generation/Wyomind
/data1/projects/trc/staging/magento2/pub/static/deployed_version.txt
Updating modules:
Schema creation/updates:
...
...
...
Installing data... Upgrading data...
[UnexpectedValueException]
Unable to retrieve deployment version of static files from the file system.
[Magento\Framework\Exception\FileSystemException]
Cannot read contents from file "/www/magento2/pub/static/deployed_version.txt" Warning!file_get_contents(/www/magento2/pub/static/deployed_version.txt
): failed to open stream: No such file or directory
setup:upgrade [--keep-generated] [--magento-init-params="..."]
Override protected function readValue($appMode)
from \Magento\Framework\App\View\Deployment\Version
```
protected function readValue($appMode)
{
switch ($appMode) {
case MagentoFrameworkAppState::MODE_DEFAULT:
case MagentoFrameworkAppState::MODE_PRODUCTION:
try {
$result = $this->versionStorage->load();
} catch (UnexpectedValueException $e) {
$result = (new DateTime())->getTimestamp();
$this->versionStorage->save($result);
}
break;
case \Magento\Framework\App\State::MODE_DEVELOPER:
$result = (new \DateTime())->getTimestamp();
break;
default:
$result = $this->versionStorage->load();
}
return $result;
}
````
Shouldn't this issue be reopened as i'm is still experiencing it in CE 2.1.6?
Sadly, this still persists in CE 2.1.7
Still persists in 2.1.8 - Please re-open!
I had same issue, resolved by clearing browser cache.
I recompiled the static content and this fixed the issue for me:
php bin/magento setup:static-content:deploy
Confirming that this issue still exists on a fresh install of Magento 2.2.2.
@willcodeforfood I reopened this issue. Could you add steps to reproduce on fresh magento 2.2.2 installation?
Confirming that this issue still exists on a fresh install of Magento 2.2.2.
@knidie , @rorteg , @willcodeforfood ,
We were not able to reproduce this issue by following the steps:
Try enabling developer mode (or production mode then switching back to developer mode). This was something I did leading up to the error, although I'm not sure if it's related.
what we did is just to keep the whole folder pub/static and after it was deleted by the compilation restore it to the same place, thats it
I recently switched the static-content signing on. Nothing of the above helped, the deploy_version always was deleted by grunt exec, switching to develop mode as recommended by @willcodeforfood then helped.
Simply deploy static files and upgrade again with bin/magento setup:upgrade.
@willcodeforfood , if you want deploy static content on developer mode, run this command :
php bin/magento setup:static-content:deploy -f
@knidie, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
FWIW, I've just encountered this on 2.2 on a fresh install.
I had this issue on magento 2.1, but I don't have it on magento 2.2. If someone have this issue - please provide actual steps to reproduce on clean magento installation. Otherwise this issue will keep closed
Clean install of 2.2.2 using the CLI, in production mode.
Ignore that commit reference, though, that shouldn't have shown up here and was removed from that repository. Its not the correct solution.
Issue still exists in version 2.2.3
Problem came up when switching from production mode to developer mode.
@gjportegies could you prepare actual steps to reproduce on clean magento installation?
"Clean install of 2.2.2 using the CLI, in production mode." :)
@xtfer this is not steps to reproduce. Which steps/commands should I execute in order to reproduce this issue?
@ihor-sviziev I'm not sure at this point. But I think it happens when switching from production to developer mode while still having JS and CSS minifying and merging enabled.
UPDATE: switching the following line in the server block of the NGINX config file from "production" to "developer" solved my issues:
set $MAGE_MODE developer;
Similar situation to @xtfer. Clean install of Magento 2.2.3 using:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition
php bin/magento setup:static-content:deploy -f
fixes error by creating deployed_version.txt in pub/static but front and backend load without css.I just encountered the same issue on version 2.2.4.
We automatically deploy Magento to AWS when a commit to a Git repository is made. During the deployment, we run some Magento CLI commands (for example setup:upgrade
, cache:clean
, and cache:flush
).
Magento is running in _production_ mode and this shouldn't happen in my opinion. As it is now I do not have the confidence to set up a fully automated deployment process with Magento 2 for a production shop, so I am stuck with having manual steps in my deployment process which drastically effects scalability.
Edit: I could "solve" the problem by running bin/magento setup:static-content:deploy -f
@kevingimbel if you still have this issue on latest Magento version (2.2.6 atm) - let us know by creating new issue. We'll re-check it
got this issue on M2.2 also.
Fixed it by adding: "static_content_on_demand_in_production" in the app/etc/env.php
source: https://devdocs.magento.com/guides/v2.2/cloud/env/variables-intro.html
@mklooss Hi! I'm using magento 2.2.2.
I've the same problem.
How and where i must write:
static_content_on_demand_in_production
In app/etc/env.php
In which line?
This is my env.php : https://pastebin.com/Djhqczej
Thanks.
@mklooss Hi! I'm using magento 2.2.2.
I've the same problem.How and where i must write:
static_content_on_demand_in_productionIn app/etc/env.php
In which line?This is my env.php : https://pastebin.com/Djhqczej
Thanks.
You can add it like this:
https://gist.github.com/ihor-sviziev/367a8a068c8141adad92812a6b8ea0be/revisions#diff-a9565219ff1cc95ce0ccd0d138bbf45f
But actually the issue was fixed in newer Magento version, so it' better to update to latest magento 2.2.x release
I have the same issue on 2.3.3
The solution static_content_on_demand_in_production works
thx
I have Magento 2.3.3 and same issue.
When in production mode only
Using commands grunt clean or grunt exec delete the file deployed_version.txt and then complains it can't find the vesrion. To me this definitely seems like a bug.
@aliomattux,
What you mentioned looks like separate issue. We didn't have this issue since magento 2.2.x.
Could you report separate issue with exact steps to reproduce?
Thank you!
Using commands grunt clean or grunt exec delete the file deployed_version.txt and then complains it can't find the vesrion. To me this definitely seems like a bug.
same error on a 2.3.1
executing grunt:exec loses deployed_version.txt and creates the problem.
@sy-salvo
What you mentioned looks like separate issue. We didn't have this issue since magento 2.2.x.
Could you report separate issue with exact steps to reproduce?
Thank you!
Hi @ihor-sviziev
This is just happening when i run the command
grunt exec:theme_name
while in production mode.
And this gives the error:
Unable to retrieve deployment version of static files from the file system.
The deployed_version.txt file is missing after running the command.
I don't know if it can be a real issue (grunt command remove all files from pub/static and first of all: should we use grunt in production mode?)
We tried this command in production mode because we were experiencing some differences between the "grunted" generated files and the deployed ones with setup:static-content:deploy command in pub/static.
@sy-salvo: Magento doesn't recommend to use grunt in production mode. In production mode, you should use the bin/magento setup:static-content:deploy [bunch-of-optional-flags...]
command.
If you need a module to use the node.js less compiler (instead of the php one) in production, you can for example use something like this, which should result in the exact same output in production as in development.
thanks @hostep for your feedback.
It's ok for us using setup:static-content:deploy
just figuring out the deepest differences between two methods, in order to understand some minor different results.
What do you mean Magento doesn't recommend using grunt in production mode, why is it provided then? Do you have a link to official documentation that states this?
For me, static content deploy does not compile less. We are using less, and our custom theme has less. If I was to do as you suggest, I would have broken css.
Static content deploy do compile less files with php library, and there is
a diff in it and in lessc compiler, that’s why you will see the difference
On Thu, 27 Feb 2020 at 11:49, Kyle Waid notifications@github.com wrote:
What do you mean Magento doesn't recommend using grunt in production mode,
why is it provided then? Do you have a link to official documentation that
states this?For me, static content deploy does not compile less. We are using less,
and our custom theme has less. If I was to do as you suggest, I would have
broken css.
Yes, actually we encountered the problem just because of this.
But executing the grunt command on production mode gives us the "deployed_version.txt" problem
In my tests, using static content deploy does not correctly compile and show changes to less. The only way I was able to get it to work was to use grunt exec and then grunt less. My understanding is that you would either use static content deploy OR grunt, not both. Grunt performs the same actions as static deploy. I do not believe the comment about not recommending grunt in production mode is factual unless an official source could be provided to verify that claim.
To get around the issue of deploy file deleting, In env.php I set the mode 'static_content_on_demand_in_production' as mentioned in a previous post. Using grunt without, will delete the version file when using grunt exec. I verified this on multiple independent deployments. Some have suggested that the deploy file deleting is a separate issue. Would recommend whoever to file a new issue with steps to reproduce on a fresh install. I am satisfied where my project is so will not work on this issue further. I would also test using 2.3.4, however there are a surprising number of core issues in 2.3.3, so I don't have confidence that upgrading wouldn't introduce new issues.
@aliomattux thanks for sharing.
Your scenario is very similar to our.
At least, if i correctly understood the first part of your post, we can use production mode not deploying static view files with setup:static-conten:deploy but using grunt:exec and grunt:less
Are u using this approach in production?
thanks
One of the reasons why running setup:static-content:deploy
instead of grunt
on production is prefered, is that it can also take care of minifying and/or bundling of javascript files, minifying of html, ...
I'm pretty sure that the grunt
scripts Magento provides out of the box do not provide that kind of functionality.
Look, you can run grunt
in production, and by all means if this works for you and you are happy with it you can certainly do it, but I'm pretty sure Magento doesn't recommend it (even though I can't really find this on devdocs after searching around a bit).
The downside of using setup:static-content:deploy
for less compilation when using the less.php compiler which Magento ships with, is that it might indeed cause slightly different output then when you compile less with the less.js library.
Therefore, you can swap the library to compile less files from less.php to less.js using that module I refered to earlier (the readme is a bit outdated, you should be able to use less.js v2 or v3 by now and that shrinkwrapping is no longer best practice, so if you are familiar enough with nodejs/npm you can probably figure everything out by not following the readme exactly)
I also had this issue.
@knidie as temporary solution you could just create empty file in following path: /var/www/html/magento2/pub/static/deployed_version.txt
Thanks worked
Most helpful comment
I also had this issue.
@knidie as temporary solution you could just create empty file in following path: /var/www/html/magento2/pub/static/deployed_version.txt