使用的laravel框架,直接composer update 直接报错?[已解决]

1. 运行环境

macos Monterey 12.3

1). 当前使用的 Laravel 版本?

Laravel 8.5

php artisan –version 命令报错

使用的laravel框架,直接composer update 直接报错,找不到原因? 请问下有人遇到过吗?

2). 当前使用的 php/php-fpm 版本?

PHP 版本:

PHP 7.4.28 (cli) (built: Mar 3 2022 06:26:49) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies
with Xdebug v2.9.0, Copyright (c) 2002-2019, by Derick Rethans

php-fpm 版本:

Nginx 29098 0.0 0.0 34122844 852 s000 S+ 4:31PM 0:00.00 grep php-fpm.conf

3). 当前系统

macOS Monterey 12.3

4). 业务环境

使用的 mycms 的系统最新版,不能执行这个命令。作者也不知道原因。

5). 相关软件版本

3.2

2. 问题描述?

以下两个命令均报错

composer update
php artisan –version

错误截图

使用的laravel框架,直接composer update 直接报错,找不到原因? 请问下有人遇到过吗?

3. 您期望得到的结果?

解决这个错误,正常运行升级的命令。

4. 您实际得到的结果?

Nginx@MacBook-Pro cms.biorun.com % php artisan --version

   Illuminate\Contracts\Container\BindingResolutionException 

  Target class [CommandMakeCommand] does not exist.

  at vendor/laravel/framework/src/Illuminate/Container/Container.php:879
    875876try {
    877$reflector = new ReflectionClass($concrete);
    878} catch (ReflectionException $e) {879throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e);
    880}
    881882// If the type is not instantiable, the developer is attempting to resolve
    883// an abstract type such as an Interface or Abstract Class and there is

      +13 vendor frames 
  14  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 6
ShiKi

vendor目录删掉,重新执行composer install试试

3年前 评论

测试了,依然报错!没有变化,还是报错的那个位置!

3年前 评论

CommandMakeCommand的命名空间和路径对应得上吗?

3年前 评论
Summer

nwidart/laravel-modules 的锅,用 8.2 版本就没问题。

看下你现在的 composer.lock 里用的是什么版本: gitee.com/qq386654667/mycms/blob/m...

另外,composer update 是个非常危险的命令,除非你有 100% 的测试覆盖率,否则要避免使用。

参考:

3年前 评论
"support": {
            "issues": "https://github.com/nWidart/laravel-modules/issues",
            "source": "https://github.com/nWidart/laravel-modules/tree/v8.3.0"
        },
3年前 评论

谢谢站长,你的方案已经帮我解决了!非常感谢!
解决方案,两条命令即可:
composer remove nwidart/laravel-modules
composer require nwidart/laravel-modules:8.2

3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!