You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was playing around with the asset command, but had to create the output folders manually, along with touching the temporary files. Otherwise I got this error:
root@f6bc58f56730:/app# ./yii asset config/assets.php config/assets-prod.php
Loading configuration from 'config/assets.php'...
Collecting source bundles information...
Creating output bundle 'allBackEnd':
PHP Warning 'yii\base\ErrorException' with message 'md5_file(/app/web/assets/js/backend-temp.js): failed to open stream: No such file or directory'
in /app/vendor/yiisoft/yii2/console/controllers/AssetController.php:348
Stack trace:
#0 /app/vendor/yiisoft/yii2/console/controllers/AssetController.php(182): yii\console\controllers\AssetController->buildTarget()
#1 /app/vendor/yiisoft/yii2/base/InlineAction.php(55): yii\console\controllers\AssetController->actionCompress()
#2 /app/vendor/yiisoft/yii2/base/InlineAction.php(55): ::call_user_func_array:{/app/vendor/yiisoft/yii2/base/InlineAction.php:55}()
#3 /app/vendor/yiisoft/yii2/base/Controller.php(151): yii\base\InlineAction->runWithParams()
#4 /app/vendor/yiisoft/yii2/console/Controller.php(91): yii\base\Controller->runAction()
#5 /app/vendor/yiisoft/yii2/base/Module.php(455): yii\console\Controller->runAction()
#6 /app/vendor/yiisoft/yii2/console/Application.php(161): yii\base\Module->runAction()
#7 /app/vendor/yiisoft/yii2/console/Application.php(137): yii\console\Application->runAction()
#8 /app/vendor/yiisoft/yii2/base/Application.php(375): yii\console\Application->handleRequest()
#9 /app/yii(26): yii\base\Application->run()
#10 {main}
Below is a patch which creates the needed directory and temp-file.
diff --git a/console/controllers/AssetController.php b/console/controllers/AssetController.php
index 00fc73b..63ba279 100644
--- a/console/controllers/AssetController.php
+++ b/console/controllers/AssetController.php
@@ -11,6 +11,7 @@ use Yii;
use yii\console\Exception;
use yii\console\Controller;
use yii\helpers\Console;
+use yii\helpers\FileHelper;
use yii\helpers\VarDumper;
use yii\web\AssetBundle;
@@ -326,6 +327,11 @@ class AssetController extends Controller
protected function buildTarget($target, $type, $bundles)
{
$tempFile = $target->basePath . '/' . strtr($target->$type, ['{hash}' => 'temp']);
+ if (!is_file($tempFile)) {
+ FileHelper::createDirectory(dirname($tempFile), 0755, true);
+ touch($tempFile);
+ }
+
$inputFiles = [];
foreach ($target->depends as $name) {
Should I create a PR for this?
The text was updated successfully, but these errors were encountered:
Using Yii 2.0.2
I was playing around with the asset command, but had to create the output folders manually, along with touching the temporary files. Otherwise I got this error:
Below is a patch which creates the needed directory and temp-file.
Should I create a PR for this?
The text was updated successfully, but these errors were encountered: