oncesk / yii-node-socket

66 stars 46 forks source link

Ошибка при запуске сервера #80

Open Sirgalas opened 8 years ago

Sirgalas commented 8 years ago

Вот собствено сама ошибка

Exception 'yii\base\InvalidConfigException' with message 'Unknown component ID: nodeSocket'
in /var/www/play.lc/vendor/yiisoft/yii2/di/ServiceLocator.php:136
Stack trace:
#0 /var/www/play.lc/vendor/oncesk/yii-node-socket/lib/php/NodeSocketCommand.php(163): yii\di\ServiceLocator->get('nodeSocket')
#1 /var/www/play.lc/vendor/oncesk/yii-node-socket/lib/php/NodeSocketCommand.php(207): YiiNodeSocket\NodeSocketCommand->getComponent()
#2 /var/www/play.lc/vendor/oncesk/yii-node-socket/lib/php/NodeSocketCommand.php(197): YiiNodeSocket\NodeSocketCommand->getPidFile()
#3 /var/www/play.lc/vendor/oncesk/yii-node-socket/lib/php/NodeSocketCommand.php(187): YiiNodeSocket\NodeSocketCommand->updatePid()
#4 /var/www/play.lc/vendor/oncesk/yii-node-socket/lib/php/NodeSocketCommand.php(234): YiiNodeSocket\NodeSocketCommand->getPid()
#5 /var/www/play.lc/vendor/oncesk/yii-node-socket/lib/php/NodeSocketCommand.php(47): YiiNodeSocket\NodeSocketCommand->_start()
#6 [internal function]: YiiNodeSocket\NodeSocketCommand->actionStart()
oncesk commented 8 years ago

Hello, please check your configuration, both web app- configuration and console app

Sirgalas commented 8 years ago

console/config/main.php

return [
    'id' => 'app-console',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'controllerNamespace' => 'console\controllers',
    'controllerMap' => [
        'node-socket' => '\YiiNodeSocket\NodeSocketCommand',
    ],
    'components' => [
        'log' => [
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
    ],
    'modules' => [
        'rbac' => 'dektrium\rbac\RbacConsoleModule',

    ],
    'params' => $params,
];

frontend/config/main

 'components' => [
        'request' => [
            'csrfParam' => '_csrf-frontend',
        ],
        'user' => [
            'identityCookie' => [
                'name'     => '_frontendIdentity',
                'path'     => '/',
                'httpOnly' => true,
            ],
        ],
        'session' => [
            'name' => 'FRONTENDSESSID',
            'cookieParams' => [
                'httpOnly' => true,
                'path'     => '/',
            ],
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
            ],
        ],
        'nodeSocket' => [
            'class' => '\YiiNodeSocket\NodeSocket',
            'host' => 'localhost',
            'allowedServerAddresses' => [
                "localhost",
                "127.0.0.1"
            ],
            'origin' => '*:*',
            'sessionVarName' => 'PHPSESSID',
            'port' => 3001,
            'socketLogFile' => '/var/log/node-socket.log',
        ],
    ],

do not tell me where there may be a mistake

oncesk commented 8 years ago

Ok, sure :)

Sirgalas commented 8 years ago

please nothing just does not work. :)

oncesk commented 8 years ago

You should add

''' 'nodeSocket' => [ 'class' => '\YiiNodeSocket\NodeSocket', 'host' => 'localhost', 'allowedServerAddresses' => [ "localhost", "127.0.0.1" ], 'origin' => ':', 'sessionVarName' => 'PHPSESSID', 'port' => 3001, 'socketLogFile' => '/var/log/node-socket.log', ], '''

into your console configuration in components section

Sirgalas commented 8 years ago

thank you very much , you're the best. Good for you