Skip to content
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

Console theme/create report error #2152

Closed
helprepair opened this issue Jul 4, 2022 · 5 comments · Fixed by #2153
Closed

Console theme/create report error #2152

helprepair opened this issue Jul 4, 2022 · 5 comments · Fixed by #2153

Comments

@helprepair
Copy link

helprepair commented Jul 4, 2022

What steps will reproduce the problem?

php luya theme/create

What is the expected result?

developer@WCZ-PC MINGW64 /d/app/day01/example0001/1.1.8
$ php luya theme/create
Enter the name (lower case) of the theme you like to generate: basic
Enter the theme location where to generate (as path alias e.g. app, ): [app]
Exception 'yii\base\InvalidArgumentException' with message 'Invalid path alias: @app\themes\basic'

in D:\app\day01\example0001\1.1.8\vendor\yiisoft\yii2\BaseYii.php:154

Stack trace:
#0 D:\app\day01\example0001\1.1.8\vendor\luyadev\luya-core\console\commands\ThemeController.php(63): yii\BaseYii::getAlias('@ap
p\themes\bas...')
luyadev/luya-kickstarter-bootstrap4#1 [internal function]: luya\console\commands\ThemeController->actionCreate('basic')
luyadev/luya-kickstarter-bootstrap4#2 D:\app\day01\example0001\1.1.8\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
luyadev/luya-kickstarter-bootstrap4#3 D:\app\day01\example0001\1.1.8\vendor\yiisoft\yii2\base\Controller.php(178): yii\base\InlineAction->runWithParams(Array)
luyadev/luya-kickstarter-bootstrap4#4 D:\app\day01\example0001\1.1.8\vendor\yiisoft\yii2\console\Controller.php(182): yii\base\Controller->runAction('create', Arr
ay)
luyadev/luya-kickstarter-bootstrap4#5 D:\app\day01\example0001\1.1.8\vendor\yiisoft\yii2\base\Module.php(552): yii\console\Controller->runAction('create', Array)
luyadev/luya-kickstarter-bootstrap4#6 D:\app\day01\example0001\1.1.8\vendor\yiisoft\yii2\console\Application.php(180): yii\base\Module->runAction('theme/create',
Array)
luyadev/luya-kickstarter-bootstrap4#7 D:\app\day01\example0001\1.1.8\vendor\yiisoft\yii2\console\Application.php(147): yii\console\Application->runAction('theme/c
reate', Array)
luyadev/luya-module-cms#189 D:\app\day01\example0001\1.1.8\vendor\yiisoft\yii2\base\Application.php(384): yii\console\Application->handleRequest(Object(
yii\console\Request))
luyadev/luya-kickstarter-bootstrap4#9 D:\app\day01\example0001\1.1.8\vendor\luyadev\luya-core\base\Boot.php(238): yii\base\Application->run()
luyadev/luya-kickstarter-bootstrap4#10 D:\app\day01\example0001\1.1.8\vendor\luyadev\luya-core\bin\luya(36): luya\base\Boot->applicationConsole()
luyadev/luya-kickstarter-bootstrap4#11 {main}

What do you get instead? (A Screenshot can help us a lot!)

图片

LUYA Check ouput (run this script and post the result: luyacheck.php)

Additional infos

Q A
LUYA Version 1.1.8
PHP Version 7.4.28
Platform WNMP
Operating system Windows 10
@nadar
Copy link
Member

nadar commented Jul 4, 2022

@boehsermoe maybe you know something regarding this?

@helprepair
Copy link
Author

luyadev\luya-core\console\commands\ThemeController.php

        // $basePath = $themeLocation . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $themeName;
        $basePath = $themeLocation . '/' . 'themes' . '/' . $themeName; // fix
        $themeFolder = Yii::getAlias($basePath);

After I make this modification, I can create it successfully.

@nadar
Copy link
Member

nadar commented Jul 13, 2022

so the DIRECTORY_SEPARATOR was the problem?

@nadar
Copy link
Member

nadar commented Jul 13, 2022

But you mentioned you are on windows, so it should be \ not /. But i think its because Yii::getAlias throws an exception here: https://github.com/yiisoft/yii2/blob/master/framework/BaseYii.php#L154

@helprepair could you provide me the value of $themeLocation and $basePath before and after running Yii::getAlias?

Update: From the exception it seems to be @app\themes\basic' before running trough getAlias

@nadar nadar transferred this issue from luyadev/luya-kickstarter-bootstrap4 Jul 13, 2022
@helprepair
Copy link
Author

$ php luya theme/create
Enter the name (lower case) of the theme you like to generate: basic
Enter the theme location where to generate (as path alias e.g. app, ): [app]
string(20) "$themeLocation :@app"
string(22) "DIRECTORY_SEPARATOR :\"
string(28) "$basePath :@app\themes\basic"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants