AppAsset Directory Does not exist

I am trying to set up frontend environment I tried making AppAsset under frontend/assets
and it shows:

Invalid Configuration – yii\base\InvalidConfigException

The directory does not exist:

AppAsset.php:

<?php

namespace frontend\assets;

use yii\web\AssetBundle;

class AppAsset extends AssetBundle
{
    public $basePath = "@webroot";
    public $baseUrl = "@web";
    public $css = [
        YII_ENV_DEV ?
            "node_modules/bootstrap/dist/css/bootstrap.css" :
            "node_modules/bootstrap/dist/css/bootstrap.min.css",
    ];
    public $js = [
        YII_ENV_DEV ?
            "node_modules/bootstrap/dist/js/bootstrap.bundle.min.js" :
            "node_modules/bootstrap/dist/js/bootstrap.bundle.js",
    ];
    public $depends = [
        'yii\web\YiiAsset'
    ];
}

in my layout/main.php:
<?php /** @var \yii\web\View $this */ /** @var string $content */ use frontend\assets\AppAsset; use yii\helpers\Html; ?> <?php AppAsset::register($this); ?>

I am trying to To Register The AppAsset in layout/main.php

Paths:

What exactly is happening I tried Making new Advanced App from scratch and it worked just fine but now I am forced to work in the company project so I have no choice but to make it work Please Help.

Paste full stack trace as text here

There should be an additional ‘assets’ folder in your web folder that is writable by the application. This is where it publishes the assets that you have created so that the application can display them.

2 Likes

Thanks For that I realized that When I compared the 2 different Directory of the Projects

1 Like

Thanks for Commenting it means alot :hearts:.
I just thought that Yii was the one responsible for creating folder called assets because I got confused from the multiple assets directories in frontend and backend I solved it.

2 Likes