Magento 2: js-translation.json 404 (Not Found) on production mode
-
16-01-2021 - |
Question
After switching to the production mode, an error appeared in the console :
pub/static/adminhtml/Magento/backend/en_US/js-translation.json 404 (Not Found)
pub/static/adminhtml/Magento/backend/en_US/js-translation.json HTTP status: 404
at XMLHttpRequest.xhr.onreadystatechange (text.min.js:8)
I was looking for a solution, I found such solutions:
bin/magento c:c
bin/magento c:f
rm -rf pub/static/*
and run
php bin/magento setup:static-content:deploy en_US
or
php -d memory_limit=4G bin/magento setup:static-content:deploy en_US
And I'm trying this :
In vendor/magento/module-translation/Model/Json/PreProcessor.php
$area = $this->areaList->getArea($areaCode);
$area->load(\Magento\Framework\App\Area::PART_TRANSLATE);
needs to be:
$area = $this->areaList->getArea($areaCode);
$area->load(\Magento\Framework\App\Area::PART_DESIGN);
$area->load(\Magento\Framework\App\Area::PART_TRANSLATE);
But this did not help me, Magento still does not find the file :
pub/static/adminhtml/Magento/backend/en_US/js-translation.json
Solution
I used this command :
bin/magento setup:static-content:deploy --theme=Vendor/Theme en_US -f
This command created js-translation.json
.
This solved my problem.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange