When using the yii framework use, there is an extra web directory

the problem has been solved, and the answer is given by the downstairs
Fractal boss

"components" => [
    "assetManager" => [
            "basePath" => "@webroot/asset/", // 
            "baseUrl"  => "@web/asset/", // 
        ],
]

but I tried to add this. It didn"t work. I made changes

.
"assetManager" => [
                "basePath" => "@webroot",
                "baseUrl"  => "@web",
            ],

in this way, there will be no problem after adding

< hr > < hr >

when I was running a project of a former colleague locally, I encountered this problem:

< hr >

The directory does not exist: C:/phpStudy/PHPTutorial/WWW/freshman/frontend/web/assets

Exception 
Invalid Configuration  yii\base\InvalidConfigException
The directory does not exist: C:/phpStudy/PHPTutorial/WWW/freshman/frontend/web/assets

I found the location of the file, and his reference code is as follows

use frontend\assets\LqcxMainAsset;
use frontend\assets\IELqcxMainAsset; 

LqcxMainAsset::register($this);
IELqcxMainAsset::register($this);

if there is an extra web, there should be something wrong with the routing. After looking for it for a long time, I still can"t find anything wrong.

the suspicion is:
the location of this file is:


     \freshman\frontend\themes\freshman\layouts\index-lqcx.php

lend a helping hand to all kinds of heroes! -sharp-sharp-sharp problem description

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Jan.17,2022

The

assets directory is for front-end resources (automatically deployed according to the project configuration and the needs of the widge used)
ide/2.0/structure-assets" rel=" nofollow noreferrer "> https://www.yiichina.com/doc/.

A more rough way, the configuration file of the project

'components' => [
    'assetManager' => [
            'basePath' => '@webroot/asset/', // 
            'baseUrl'  => '@web/asset/', // 
        ],
]

if you want to find the reason, you need more relevant code. If you are in a hurry, just be simple and rude first

.
  • Bower-asset/typeahead.js/dist doesn't exist?

    yii base InvalidArgumentException: The file or directory to be published does not exist: home vagrant yii test vendor bower-asset typeahead.js dist in home vagrant yii test vendor yiisoft yii2 web AssetManager.php:456 Stack trace: -sharp0 home vagra...

    Apr.07,2021
Menu