-
Notifications
You must be signed in to change notification settings - Fork 9.4k
update to 2.1.1 can not deploy content files #6426
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
Comments
I also had this issue. |
thanks, it works great!! |
Indeed, I noticed this too: magento/devdocs#419 (comment) 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... |
…content:deploy After Upgrading to Magento 2.1.1 we had following exception when magento mode is "production" and we executing php bin/magento setup:statis-content:deploy: ``` [Magento\Framework\Exception\FileSystemException] Cannot read contents from file "/vhosts/www/magento2/pub/static/deployed_version.txt" Warning!file_get_contents(/vhosts/www/magento2/pub/static/deployed_version.txt): failed to open stream: N o such file or directory Exception trace: () at /vhosts/www/magento2/vendor/magento/framework/Filesystem/Driver/File.php:149 Magento\Framework\Filesystem\Driver\File->fileGetContents() at /vhosts/www/magento2/vendor/magento/framework/Filesystem/Directory/Read.php:207 Magento\Framework\Filesystem\Directory\Read->readFile() at /vhosts/www/magento2/vendor/magento/framework/App/View/Deployment/Version/Storage/File.php:44 Magento\Framework\App\View\Deployment\Version\Storage\File->load() at /vhosts/www/magento2/vendor/magento/framework/App/View/Deployment/Version.php:77 Magento\Framework\App\View\Deployment\Version->readValue() at /vhosts/www/magento2/vendor/magento/framework/App/View/Deployment/Version.php:49 Magento\Framework\App\View\Deployment\Version->getValue() at /vhosts/www/magento2/vendor/magento/module-theme/Model/Url/Plugin/Signature.php:88 Magento\Theme\Model\Url\Plugin\Signature->renderUrlSignature() at /vhosts/www/magento2/vendor/magento/module-theme/Model/Url/Plugin/Signature.php:66 Magento\Theme\Model\Url\Plugin\Signature->aroundGetBaseUrl() at /vhosts/www/magento2/vendor/magento/framework/Interception/Interceptor.php:142 Magento\Store\Model\Store\Interceptor->___callPlugins() at /vhosts/www/magento2/var/generation/Magento/Store/Model/Store/Interceptor.php:143 Magento\Store\Model\Store\Interceptor->getBaseUrl() at /vhosts/www/magento2/vendor/magento/framework/Url.php:452 Magento\Framework\Url->getBaseUrl() at /vhosts/www/magento2/vendor/magento/framework/View/Asset/Repository.php:266 Magento\Framework\View\Asset\Repository->getFallbackContext() at /vhosts/www/magento2/vendor/magento/framework/View/Asset/Repository.php:244 Magento\Framework\View\Asset\Repository->getStaticViewFileContext() at /vhosts/www/magento2/vendor/magento/framework/RequireJs/Config.php:123 Magento\Framework\RequireJs\Config->__construct() at /vhosts/www/magento2/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:93 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() at /vhosts/www/magento2/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:89 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vhosts/www/magento2/vendor/magento/framework/ObjectManager/ObjectManager.php:57 Magento\Framework\ObjectManager\ObjectManager->create() at /vhosts/www/magento2/vendor/magento/module-deploy/Model/Deployer.php:252 Magento\Deploy\Model\Deployer->deploy() at /vhosts/www/magento2/vendor/magento/module-deploy/Console/Command/DeployStaticContentCommand.php:445 Magento\Deploy\Console\Command\DeployStaticContentCommand->deploy() at /vhosts/www/magento2/vendor/magento/module-deploy/Console/Command/DeployStaticContentCommand.php:468 Magento\Deploy\Console\Command\DeployStaticContentCommand->Magento\Deploy\Console\Command\{closure}() at n/a:n/a call_user_func() at /vhosts/www/magento2/vendor/magento/module-deploy/Model/Process.php:53 Magento\Deploy\Model\Process->run() at /vhosts/www/magento2/vendor/magento/module-deploy/Model/ProcessManager.php:41 Magento\Deploy\Model\ProcessManager->fork() at /vhosts/www/magento2/vendor/magento/module-deploy/Console/Command/DeployStaticContentCommand.php:473 Magento\Deploy\Console\Command\DeployStaticContentCommand->runProcessesInParallel() at /vhosts/www/magento2/vendor/magento/module-deploy/Console/Command/DeployStaticContentCommand.php:371 Magento\Deploy\Console\Command\DeployStaticContentCommand->execute() at /vhosts/www/magento2/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257 Symfony\Component\Console\Command\Command->run() at /vhosts/www/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:874 Symfony\Component\Console\Application->doRunCommand() at /vhosts/www/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:195 Symfony\Component\Console\Application->doRun() at /vhosts/www/magento2/vendor/magento/framework/Console/Cli.php:96 Magento\Framework\Console\Cli->doRun() at /vhosts/www/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:126 Symfony\Component\Console\Application->run() at /vhosts/www/magento2/bin/magento:23 ``` This pull request will fix this issue. Fixes magento#6426
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
|
@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 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). Thanks! |
Hi @knidie, |
I had this problem only when I enabled signing of static files. in: |
@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:
|
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 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 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:
|
Override
|
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: Similar situation to @xtfer. Clean install of Magento 2.2.3 using:
|
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 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 |
@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 Code:
|
@mklooss Hi! I'm using magento 2.2.2. How and where i must write: In app/etc/env.php This is my env.php : https://pastebin.com/Djhqczej Thanks. |
You can add it like this: 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 |
@aliomattux, Thank you! |
same error on a 2.3.1 executing grunt:exec loses deployed_version.txt and creates the problem. |
@sy-salvo Thank you! |
This is just happening when i run the command
while in production mode. And this gives the error:
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 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. |
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 ***@***.***> 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 thanks |
One of the reasons why running Look, you can run The downside of using |
Thanks worked |
MCLOUD-7366: Static test failure with AWS S3 module name
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.
[Magento\Framework\Exception\FileSystemException]
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
The text was updated successfully, but these errors were encountered: