Setting unknown property: yiiconsoleErrorHandler::errorAction on linux server

I just uploaded my yii advanced project to my centos server, but I can’t seem to get past the migrate phase. When I try to run yii migrate the following error occurred:

`Setting unknown property: yiiconsoleErrorHandler::errorAction’

I have no idea why this happens, because it works fine when I run it locally on my windows computer.

My yii advance project is bit different than a normal Yii advanced. The backend has been separated from the frontend so it just contains the console and frontend directory.

common/config/main.php

$config = require(__DIR__ . '/main-console.php');
array_push($config['bootstrap'], 'site');
$config['components']['errorHandler'] = [
    'errorAction' => 'site/error',
];
$config['components']['user'] = [
    'identityClass' => 'frontendmodelsUser',
    'enableAutoLogin' => true,
];

$config['components']['session'] = [
    'name' => 'PHPFRONTSESSID',
    'savePath' => sys_get_temp_dir(),
];

$config['components']['request'] = [
    'cookieValidationKey' => 'IBzCJMjLWUaXMZemYUej',
    'csrfParam' => '_frontendCSRF',
];

$config['components']['site'] = [
    'class' => 'frontendcomponentsSiteComponent',
];

return $config;

main-console.php

$params = array_merge(
    require(__DIR__ . '/params.php')
);

return [
    'id' => 'app-frontend',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log','debug'],
    'sourceLanguage' => 'en-US',
    'controllerNamespace' => 'frontendcontrollers',
    'aliases' => [
        '@local_media' => '@frontend/web/uploads/media',
    ],
    'modules' => [
        'debug' => [
            'class' => 'yiidebugModule',
        ],
    ],
    'components' => [
        'cache' => [
            'class' => 'yiicachingFileCache',
        ],
        'i18n' => [
            'translations' => [
                'app*' => [
                    'class' => 'yiii18nPhpMessageSource',
                    'basePath' => '@frontend/messages',
                ],
            ],
        ],
        'assetManager' => [
            'bundles' => false,
        ],
        'mailer' => [
            'class' => 'yiiswiftmailerMailer',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yiilogFileTarget',
                    'levels' => ['error', 'warning', 'trace'],
                ],
            ],
        ],
        'defaultRoute' => 'site/view',
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => true,
            'enableStrictParsing' => false,
            'rules' => require('routes.php'),
        ],
    ],
    'params' => $params,
];

Can someone give me some advies on how to solve this problem?

Answer

You problem is that you specify error action into common/config/main.php. Error action must be used only with web apps, not console. So move this to your frontend and backend configs separately:

$config['components']['errorHandler'] = [
    'errorAction' => 'site/error',
];