freadman
V2EX  ›  PHP

Mac 系统的终端运行 composer dump-autoload 正常, VS code 集成终端报错,求解?

  •  
  •   freadman · May 22, 2022 · 2182 views
    This topic created in 1451 days ago, the information mentioned may be changed or developed.

    我的程序 laravel8 ,PHP 是 8.0.8 ,安装了 memcached 扩展,php -v 显示版本 8.0.8 ,php -m 可以看到 memcached 扩展。

    同样的命令 composer dump-autoload ,系统的终端中执行是正常的,在 VS code 集成终端中就报错。难不成 vscode 还有什么特殊的配置?并且我在集成终端和系统终端运行 php -v 、php -m 结果是一样的。

    报错信息:

    Class "Memcached" not found

    at vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php:69 65| * @return \Memcached 66| */ 67| protected function createMemcachedInstance($connectionId) 68| {

    69| return empty($connectionId) ? new Memcached : new Memcached($connectionId); 70| } 71| 72| /** 73| * Set the SASL credentials on the Memcached connection.

      +9 vendor frames 
    

    10 [internal]:0 Spatie\Permission\PermissionRegistrar::__construct(Object(Illuminate\Cache\CacheManager))

      +14 vendor frames 
    

    25 [internal]:0 Illuminate\Foundation\Application::Illuminate\Foundation{closure}(Object(Spatie\Permission\PermissionServiceProvider)) Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

    3 replies    2022-05-23 10:25:25 +08:00
    FrankAdler
        1
    FrankAdler  
       May 23, 2022 via iPhone
    环境变量不一致,导致调用的不是同一个 php 吧
    dzdh
        2
    dzdh  
       May 23, 2022
    composer.json 里加一个 script. php -i
    freadman
        3
    freadman  
    OP
       May 23, 2022
    @FrankAdler 确实是这个问题,安装了多个 PHP 。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2643 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 68ms · UTC 16:02 · PVG 00:02 · LAX 09:02 · JFK 12:02
    ♥ Do have faith in what you're doing.