Php 未能实例化组件或类“yii\gii\Module”

Php 未能实例化组件或类“yii\gii\Module”,php,yii2,Php,Yii2,我刚刚在Mac os上创建了新的Yii 2应用程序。我使用的PHP版本是7.3版。Composer安装工作正常,但当我尝试使用命令php yii serve启动应用程序时,出现以下错误 Exception 'yii\base\InvalidConfigException' with message 'Failed to instantiate component or class "yii\gii\Module".' in /Users/krishnadas/Desktop

我刚刚在Mac os上创建了新的Yii 2应用程序。我使用的PHP版本是7.3版。Composer安装工作正常,但当我尝试使用命令php yii serve启动应用程序时,出现以下错误

Exception 'yii\base\InvalidConfigException' with message 'Failed to instantiate component or class "yii\gii\Module".'

in /Users/krishnadas/Desktop/thejas/lms/vendor/yiisoft/yii2/di/Container.php:449

Stack trace:
#0 /Users/krishnadas/Desktop/thejas/lms/vendor/yiisoft/yii2/di/Container.php(374): yii\di\Container->getDependencies('yii\\gii\\Module')
#1 /Users/krishnadas/Desktop/thejas/lms/vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build('yii\\gii\\Module', Array, Array)
#2 /Users/krishnadas/Desktop/thejas/lms/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('yii\\gii\\Module', Array, Array)
#3 /Users/krishnadas/Desktop/thejas/lms/vendor/yiisoft/yii2/base/Module.php(427): yii\BaseYii::createObject(Array, Array)
#4 /Users/krishnadas/Desktop/thejas/lms/vendor/yiisoft/yii2/base/Application.php(315): yii\base\Module->getModule('gii')
#5 /Users/krishnadas/Desktop/thejas/lms/vendor/yiisoft/yii2/base/Application.php(273): yii\base\Application->bootstrap()
#6 /Users/krishnadas/Desktop/thejas/lms/vendor/yiisoft/yii2/console/Application.php(124): yii\base\Application->init()
#7 /Users/krishnadas/Desktop/thejas/lms/vendor/yiisoft/yii2/base/BaseObject.php(109): yii\console\Application->init()
#8 /Users/krishnadas/Desktop/thejas/lms/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#9 /Users/krishnadas/Desktop/thejas/lms/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array)
#10 /Users/krishnadas/Desktop/thejas/lms/yii(19): yii\console\Application->__construct(Array)
#11 {main}
当我运行composer update时,会出现更多类似这样的错误

 ailed to extract yiisoft/yii2-bootstrap: (9) unzip -qq  '/Users/krishnadas/Desktop/thejas/basic/vendor/composer/tmp-26e4a5cb7b14ec2c9244cc7f29b77c9d' -d '/Users/krishnadas/Desktop/thejas/basic/vendor/composer/63a3aea5'
    
    unzip:  cannot find or open /Users/krishnadas/Desktop/thejas/basic/vendor/composer/tmp-26e4a5cb7b14ec2c9244cc7f29b77c9d.
    
        This most likely is due to a custom installer plugin not handling the returned Promise from the downloader
        See https://github.com/composer/installers/commit/5006d0c28730ade233a8f42ec31ac68fb1c5c9bb for an example fix
        Failed to extract yiisoft/yii2-debug: (9) unzip -qq  '/Users/krishnadas/Desktop/thejas/basic/vendor/composer/tmp-ee4e9bc3f65bc1e6d3bb29c47448147f' -d '/Users/krishnadas/Desktop/thejas/basic/vendor/composer/c3a14115'

unzip:  cannot find or open /Users/krishnadas/Desktop/thejas/basic/vendor/composer/tmp-ee4e9bc3f65bc1e6d3bb29c47448147f.

    This most likely is due to a custom installer plugin not handling the returned Promise from the downloader
    See https://github.com/composer/installers/commit/5006d0c28730ade233a8f42ec31ac68fb1c5c9bb for an example fix
    Failed to extract yiisoft/yii2-faker: (9) unzip -qq  '/Users/krishnadas/Desktop/thejas/basic/vendor/composer/tmp-adfed1b28e8eb6386664db1dc98849ab' -d '/Users/krishnadas/Desktop/thejas/basic/vendor/composer/d8990f9a'

unzip:  cannot find or open /Users/krishnadas/Desktop/thejas/basic/vendor/composer/tmp-adfed1b28e8eb6386664db1dc98849ab.

    This most likely is due to a custom installer plugin not handling the returned Promise from the downloader
    See https://github.com/composer/installers/commit/5006d0c28730ade233a8f42ec31ac68fb1c5c9bb for an example fix
    Failed to extract yiisoft/yii2-gii: (9) unzip -qq  '/Users/krishnadas/Desktop/thejas/basic/vendor/composer/tmp-a51d0a4cc1fef91725fe727eb3a41a43' -d '/Users/krishnadas/Desktop/thejas/basic/vendor/composer/eaed0437'

unzip:  cannot find or open /Users/krishnadas/Desktop/thejas/basic/vendor/composer/tmp-a51d0a4cc1fef91725fe727eb3a41a43.

    This most likely is due to a custom installer plugin not handling the returned Promise from the downloader
    See https://github.com/composer/installers/commit/5006d0c28730ade233a8f42ec31ac68fb1c5c9bb for an example fix
    Failed to extract yiisoft/yii2-swiftmailer: (9) unzip -qq  '/Users/krishnadas/Desktop/thejas/basic/vendor/composer/tmp-d3e0c5f68aded7a5357259ffde56f5ea' -d '/Users/krishnadas/Desktop/thejas/basic/vendor/composer/3514a4ce'

unzip:  cannot find or open /Users/krishnadas/Desktop/thejas/basic/vendor/composer/tmp-d3e0c5f68aded7a5357259ffde56f5ea.

    This most likely is due to a custom installer plugin not handling the returned Promise from the downloader
    See https://github.com/composer/installers/commit/5006d0c28730ade233a8f42ec31ac68fb1c5c9bb for an example fix`

当我将composer降级到最新的稳定版本1.10.7时,它终于起作用了。版本2的某些安装项目(如gii)存在问题。

您可以提供一些配置吗?您使用的是基本模板还是高级模板?我使用的是基本模板,没有任何更改。它只是一个新安装,与yii2安装设置相同。在发球前有什么需要改变的吗?没有,不是真的,只是想问一下。你打过哪个网址?你能告诉我你的步骤吗?你用过这个指南吗?我们已经测试过了,效果很好。唯一不同的是,我使用的是php7.4,我使用的url与您评论的相同。您使用的是Composer 2吗?某些插件可能与Composer 2不兼容,您可能需要先升级它们。看见