Container::make()方法未找到. Call to a member function make() on null.

phperjiang

Error: Call to a member function make() on null in /usr/src/myapp/vendor/workerman/webman-framework/src/support/Container.php:46
Stack trace:

0 /usr/src/myapp/vendor/workerman/webman-framework/src/support/bootstrap/LaravelDb.php(72): support\Container::__callStatic('make', Array)

1 /usr/src/myapp/support/bootstrap.php(77): support\bootstrap\LaravelDb::start(Object(Workerman\Worker))

2 /usr/src/myapp/support/helpers.php(335): require_once('/usr/src/myapp/...')

3 /usr/src/myapp/vendor/workerman/workerman/Worker.php(2457): {closure}(Object(Workerman\Worker))

4 /usr/src/myapp/vendor/workerman/workerman/Worker.php(1579): Workerman\Worker->run()

5 /usr/src/myapp/vendor/workerman/workerman/Worker.php(1420): Workerman\Worker::forkOneWorkerForLinux(Object(Workerman\Worker))

6 /usr/src/myapp/vendor/workerman/workerman/Worker.php(1394): Workerman\Worker::forkWorkersForLinux()

7 /usr/src/myapp/vendor/workerman/workerman/Worker.php(560): Workerman\Worker::forkWorkers()

8 /usr/src/myapp/start.php(112): Workerman\Worker::runAll()

1361 2 1
2个回答

yzh52521

你去看下 依赖注入那章文档

  • phperjiang 2023-02-15

    不解啊,具体怎么修改呢?

  • yzh52521 2023-02-15

    安装
    composer require psr/container ^1.1.1 php-di/php-di ^6 doctrine/annotations ^1.14
    修改配置config/container.php,其最终内容如下:

    $builder = new \DI\ContainerBuilder();
    $builder->addDefinitions(config('dependence', []));
    $builder->useAutowiring(true);
    $builder->useAnnotations(true);
    return $builder->build();

  • phperjiang 2023-02-15

    项目已经是这个配置,不是这个地方的问题

智佳思远

怎么创建的webman项目?怎么安装的?
是不是用了composer代理,下载了旧的代码哦。

  • phperjiang 2023-02-15

    使用 composer repo:use composer,切换为官方源
    删除composer.lock,/vender
    重新执行composer update
    问题依然存在 o(╥﹏╥)o

  • phperjiang 2023-02-15

    项目之前是可以正常运行的
    近期执行composer update,之后就不可用了
    本地和测试环境抛出一样的错误
    刚开始也怀疑是代理的问题,试了很多次都没用

  • 智佳思远 2023-02-15

    之前看过类似帖子,作者说webman1.2 或以下版本不支持直接升级。让重新创建个项目,然后把代码拷贝过去。

  • phperjiang 2023-02-15

    啊这....我试试

年代过于久远,无法发表回答
×
🔝