运行 windows 上的 yii2 高级模板时出现 InvalidConfigException
InvalidConfigException when running yii2 advanced template on windows
我是 运行 feature-1-login 分支下的代码:
https://github.com/dzidlicious/invest-tracker
在 运行 docker-组合并访问应用程序的后端部分后,我得到以下堆栈跟踪:
yii\base\ErrorException: Exception (Invalid Configuration) 'yii\base\InvalidConfigException' with message 'The directory does not exist: '
in /app/vendor/yiisoft/yii2/web/AssetManager.php:236
Stack trace:
#0 /app/vendor/yiisoft/yii2/web/AssetManager.php(546): yii\web\AssetManager->checkBasePathPermission()
#1 /app/vendor/yiisoft/yii2/web/AssetManager.php(478): yii\web\AssetManager->publishDirectory('/app/vendor/yii...', Array)
#2 /app/vendor/yiisoft/yii2/web/AssetBundle.php(181): yii\web\AssetManager->publish('/app/vendor/yii...', Array)
#3 /app/vendor/yiisoft/yii2/web/AssetManager.php(292): yii\web\AssetBundle->publish(Object(yii\web\AssetManager))
#4 /app/vendor/yiisoft/yii2/web/AssetManager.php(263): yii\web\AssetManager->loadBundle('yii\validators\...', Array, true)
#5 /app/vendor/yiisoft/yii2/web/View.php(287): yii\web\AssetManager->getBundle('yii\validators\...')
#6 /app/vendor/yiisoft/yii2/web/AssetBundle.php(125): yii\web\View->registerAssetBundle('yii\validators\...')
#7 /app/vendor/yiisoft/yii2/validators/RequiredValidator.php(93): yii\web\AssetBundle::register(Object(yii\web\View))
#8 /app/vendor/yiisoft/yii2/widgets/ActiveField.php(833): yii\validators\RequiredValidator->clientValidateAttribute(Object(common\models\LoginForm), 'username', Object(yii\web\View))
#9 /app/vendor/yiisoft/yii2/widgets/ActiveField.php(233): yii\widgets\ActiveField->getClientOptions()
#10 /app/vendor/yiisoft/yii2/widgets/ActiveField.php(223): yii\widgets\ActiveField->begin()
#11 /app/vendor/yiisoft/yii2-bootstrap4/src/ActiveField.php(244): yii\widgets\ActiveField->render('<label for="log...')
#12 /app/vendor/yiisoft/yii2/widgets/ActiveField.php(176): yii\bootstrap4\ActiveField->render()
#13 /app/backend/views/site/login.php(27): yii\widgets\ActiveField->__toString()
#14 /app/vendor/yiisoft/yii2/base/View.php(348): require('/app/backend/vi...')
#15 /app/vendor/yiisoft/yii2/base/View.php(257): yii\base\View->renderPhpFile('/app/backend/vi...', Array)
#16 /app/vendor/yiisoft/yii2/base/View.php(156): yii\base\View->renderFile('/app/backend/vi...', Array, Object(backend\controllers\SiteController))
#17 /app/vendor/yiisoft/yii2/base/Controller.php(410): yii\base\View->render('login', Array, Object(backend\controllers\SiteController))
#18 /app/backend/controllers/SiteController.php(87): yii\base\Controller->render('login', Array)
#19 [internal function]: backend\controllers\SiteController->actionLogin()
#20 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#21 /app/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#22 /app/vendor/yiisoft/yii2/base/Module.php(534): yii\base\Controller->runAction('login', Array)
#23 /app/vendor/yiisoft/yii2/web/Application.php(104): yii\base\Module->runAction('site/login', Array)
#24 /app/vendor/yiisoft/yii2/base/Application.php(392): yii\web\Application->handleRequest(Object(yii\web\Request))
#25 /app/backend/web/index.php(17): yii\base\Application->run()
#26 {main} in /app/vendor/yiisoft/yii2/base/ErrorHandler.php:343
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleError(256, 'Exception (Inva...', '/app/vendor/yii...', 343, Array)
#1 /app/vendor/yiisoft/yii2/base/ErrorHandler.php(343): trigger_error('Exception (Inva...', 256)
#2 /app/vendor/yiisoft/yii2/widgets/ActiveField.php(178): yii\base\ErrorHandler::convertExceptionToError(Object(yii\base\InvalidConfigException))
#3 /app/backend/views/site/login.php(27): yii\widgets\ActiveField->__toString()
#4 /app/vendor/yiisoft/yii2/base/View.php(348): require('/app/backend/vi...')
#5 /app/vendor/yiisoft/yii2/base/View.php(257): yii\base\View->renderPhpFile('/app/backend/vi...', Array)
#6 /app/vendor/yiisoft/yii2/base/View.php(156): yii\base\View->renderFile('/app/backend/vi...', Array, Object(backend\controllers\SiteController))
#7 /app/vendor/yiisoft/yii2/base/Controller.php(410): yii\base\View->render('login', Array, Object(backend\controllers\SiteController))
#8 /app/backend/controllers/SiteController.php(87): yii\base\Controller->render('login', Array)
#9 [internal function]: backend\controllers\SiteController->actionLogin()
#10 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#11 /app/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#12 /app/vendor/yiisoft/yii2/base/Module.php(534): yii\base\Controller->runAction('login', Array)
#13 /app/vendor/yiisoft/yii2/web/Application.php(104): yii\base\Module->runAction('site/login', Array)
#14 /app/vendor/yiisoft/yii2/base/Application.php(392): yii\web\Application->handleRequest(Object(yii\web\Request))
#15 /app/backend/web/index.php(17): yii\base\Application->run()
#16 {main}
我特意提交了我的配置文件并附上了截图。
发生该错误是因为您缺少 backend/web/assets
文件夹并且服务器没有创建它的权限。
检查 backend/web
的所有者和权限,如果服务器无法写入,将无法创建 assets
文件夹。
您可以更新 backend/web
并使其服务器可写。
你也可以手动创建backend/web/assets
,然后更新权限并赋予服务器组rw权限,或者在项目根目录下run init
,如果你确定你没有修改任何内容覆盖。
我是 运行 feature-1-login 分支下的代码: https://github.com/dzidlicious/invest-tracker
在 运行 docker-组合并访问应用程序的后端部分后,我得到以下堆栈跟踪:
yii\base\ErrorException: Exception (Invalid Configuration) 'yii\base\InvalidConfigException' with message 'The directory does not exist: '
in /app/vendor/yiisoft/yii2/web/AssetManager.php:236
Stack trace:
#0 /app/vendor/yiisoft/yii2/web/AssetManager.php(546): yii\web\AssetManager->checkBasePathPermission()
#1 /app/vendor/yiisoft/yii2/web/AssetManager.php(478): yii\web\AssetManager->publishDirectory('/app/vendor/yii...', Array)
#2 /app/vendor/yiisoft/yii2/web/AssetBundle.php(181): yii\web\AssetManager->publish('/app/vendor/yii...', Array)
#3 /app/vendor/yiisoft/yii2/web/AssetManager.php(292): yii\web\AssetBundle->publish(Object(yii\web\AssetManager))
#4 /app/vendor/yiisoft/yii2/web/AssetManager.php(263): yii\web\AssetManager->loadBundle('yii\validators\...', Array, true)
#5 /app/vendor/yiisoft/yii2/web/View.php(287): yii\web\AssetManager->getBundle('yii\validators\...')
#6 /app/vendor/yiisoft/yii2/web/AssetBundle.php(125): yii\web\View->registerAssetBundle('yii\validators\...')
#7 /app/vendor/yiisoft/yii2/validators/RequiredValidator.php(93): yii\web\AssetBundle::register(Object(yii\web\View))
#8 /app/vendor/yiisoft/yii2/widgets/ActiveField.php(833): yii\validators\RequiredValidator->clientValidateAttribute(Object(common\models\LoginForm), 'username', Object(yii\web\View))
#9 /app/vendor/yiisoft/yii2/widgets/ActiveField.php(233): yii\widgets\ActiveField->getClientOptions()
#10 /app/vendor/yiisoft/yii2/widgets/ActiveField.php(223): yii\widgets\ActiveField->begin()
#11 /app/vendor/yiisoft/yii2-bootstrap4/src/ActiveField.php(244): yii\widgets\ActiveField->render('<label for="log...')
#12 /app/vendor/yiisoft/yii2/widgets/ActiveField.php(176): yii\bootstrap4\ActiveField->render()
#13 /app/backend/views/site/login.php(27): yii\widgets\ActiveField->__toString()
#14 /app/vendor/yiisoft/yii2/base/View.php(348): require('/app/backend/vi...')
#15 /app/vendor/yiisoft/yii2/base/View.php(257): yii\base\View->renderPhpFile('/app/backend/vi...', Array)
#16 /app/vendor/yiisoft/yii2/base/View.php(156): yii\base\View->renderFile('/app/backend/vi...', Array, Object(backend\controllers\SiteController))
#17 /app/vendor/yiisoft/yii2/base/Controller.php(410): yii\base\View->render('login', Array, Object(backend\controllers\SiteController))
#18 /app/backend/controllers/SiteController.php(87): yii\base\Controller->render('login', Array)
#19 [internal function]: backend\controllers\SiteController->actionLogin()
#20 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#21 /app/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#22 /app/vendor/yiisoft/yii2/base/Module.php(534): yii\base\Controller->runAction('login', Array)
#23 /app/vendor/yiisoft/yii2/web/Application.php(104): yii\base\Module->runAction('site/login', Array)
#24 /app/vendor/yiisoft/yii2/base/Application.php(392): yii\web\Application->handleRequest(Object(yii\web\Request))
#25 /app/backend/web/index.php(17): yii\base\Application->run()
#26 {main} in /app/vendor/yiisoft/yii2/base/ErrorHandler.php:343
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleError(256, 'Exception (Inva...', '/app/vendor/yii...', 343, Array)
#1 /app/vendor/yiisoft/yii2/base/ErrorHandler.php(343): trigger_error('Exception (Inva...', 256)
#2 /app/vendor/yiisoft/yii2/widgets/ActiveField.php(178): yii\base\ErrorHandler::convertExceptionToError(Object(yii\base\InvalidConfigException))
#3 /app/backend/views/site/login.php(27): yii\widgets\ActiveField->__toString()
#4 /app/vendor/yiisoft/yii2/base/View.php(348): require('/app/backend/vi...')
#5 /app/vendor/yiisoft/yii2/base/View.php(257): yii\base\View->renderPhpFile('/app/backend/vi...', Array)
#6 /app/vendor/yiisoft/yii2/base/View.php(156): yii\base\View->renderFile('/app/backend/vi...', Array, Object(backend\controllers\SiteController))
#7 /app/vendor/yiisoft/yii2/base/Controller.php(410): yii\base\View->render('login', Array, Object(backend\controllers\SiteController))
#8 /app/backend/controllers/SiteController.php(87): yii\base\Controller->render('login', Array)
#9 [internal function]: backend\controllers\SiteController->actionLogin()
#10 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#11 /app/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#12 /app/vendor/yiisoft/yii2/base/Module.php(534): yii\base\Controller->runAction('login', Array)
#13 /app/vendor/yiisoft/yii2/web/Application.php(104): yii\base\Module->runAction('site/login', Array)
#14 /app/vendor/yiisoft/yii2/base/Application.php(392): yii\web\Application->handleRequest(Object(yii\web\Request))
#15 /app/backend/web/index.php(17): yii\base\Application->run()
#16 {main}
我特意提交了我的配置文件并附上了截图。
发生该错误是因为您缺少 backend/web/assets
文件夹并且服务器没有创建它的权限。
检查 backend/web
的所有者和权限,如果服务器无法写入,将无法创建 assets
文件夹。
您可以更新 backend/web
并使其服务器可写。
你也可以手动创建backend/web/assets
,然后更新权限并赋予服务器组rw权限,或者在项目根目录下run init
,如果你确定你没有修改任何内容覆盖。