最近在尝试一个自带管理后台的简单 PHP 框架:luya,按照官方文档使用 composer 安装 luya-kickstarter 时报错:

C:Apache24htdocs>composer create-project luyadev/luya-kickstarter:^1.0
Creating a "luyadev/luya-kickstarter:1.0" project at "./luya-kickstarter"
Info from https://repo.packagist.org: #StandWithUkraine
Installing luyadev/luya-kickstarter (1.0.0)
  - Downloading luyadev/luya-kickstarter (1.0.0)
  - Installing luyadev/luya-kickstarter (1.0.0): Extracting archive
Created project in C:Apache24htdocsluya-kickstarter
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - yiisoft/yii2-gii[2.0.0, ..., 2.0.4] require bower-asset/typeahead.js 0.10.* -> could not be found in any version, but the following packages provide it:
      - yidas/yii2-bower-asset Bower Assets for Yii 2 app provided via Composer repository
      - yidas/yii2-composer-bower-skip A Composer package that allows you to install or update Yii2 without Bower-Asset
      - craftcms/yii2-dynamodb Yii2 implementation of a cache, session, and queue driver for DynamoDB
      - lsat/yii2-bower-asset Bower Assets for Yii 2 app provided via Composer repository
      - pixelandtonic/yii2-dynamodb Yii2 implementation of a cache, session, and queue driver for DynamoDB
      - blackhive/yii2-app-advanced Yii 2 Advanced Project Template
      - cliff363825/yii2-bower-asset Yii2 bower asset
      - kriss/yii2-advanced Yii2 advanced project template, Frontend for API and Backend with AdminLTE
      - maiscrm/yii2-composer-bower-skip A Composer package that allows you to install or update Yii2 without Bower-Asset
      - myzero1/yii2-app-advanced Yii 2 Advanced Project Template
      - projectchina/yii2-app-advanced Yii 2 Advanced Project Template
      - stiks/yii2-composer-bower-skip A Composer package that allows you to install or update Yii2 without Bower-Asset
      - tanakahisateru/yii2-app-basic-npm How to use NPM with Yii 2 Basic Application Template
      - umono/yaa-yii2 一个基于Vue3 yii2 的后台框架,可快速助你开发。
      - umono/yii2-multiple A common and diverse Toolkit
      Consider requiring one of these to satisfy the bower-asset/typeahead.js requirement.
    - yiisoft/yii2-gii[2.0.5, ..., 2.0.8] require bower-asset/typeahead.js 0.10.* | ~0.11.0 -> could not be found in any version, but the following packages provide it:
      - yidas/yii2-bower-asset Bower Assets for Yii 2 app provided via Composer repository
      - yidas/yii2-composer-bower-skip A Composer package that allows you to install or update Yii2 without Bower-Asset
      - craftcms/yii2-dynamodb Yii2 implementation of a cache, session, and queue driver for DynamoDB
      - lsat/yii2-bower-asset Bower Assets for Yii 2 app provided via Composer repository
      - pixelandtonic/yii2-dynamodb Yii2 implementation of a cache, session, and queue driver for DynamoDB
      - blackhive/yii2-app-advanced Yii 2 Advanced Project Template
      - cliff363825/yii2-bower-asset Yii2 bower asset
      - kriss/yii2-advanced Yii2 advanced project template, Frontend for API and Backend with AdminLTE
      - maiscrm/yii2-composer-bower-skip A Composer package that allows you to install or update Yii2 without Bower-Asset
      - myzero1/yii2-app-advanced Yii 2 Advanced Project Template
      - projectchina/yii2-app-advanced Yii 2 Advanced Project Template
      - stiks/yii2-composer-bower-skip A Composer package that allows you to install or update Yii2 without Bower-Asset
      - tanakahisateru/yii2-app-basic-npm How to use NPM with Yii 2 Basic Application Template
      - umono/yaa-yii2 一个基于Vue3 yii2 的后台框架,可快速助你开发。
      - umono/yii2-multiple A common and diverse Toolkit
      Consider requiring one of these to satisfy the bower-asset/typeahead.js requirement.
    - Root composer.json requires yiisoft/yii2-gii ~2.0.0 -> satisfiable by yiisoft/yii2-gii[2.0.0, ..., 2.0.8].

产生错误的原因是 composer 在 windows 平台生成的 composer.json 引用了非常旧的依赖版本,以下是解决方法:

1.下载 luya-kickstarter 最新的 release 版本。

https://github.com/luyadev/luya-kickstarter/archive/refs/heads/master.zip

2.解压缩 zip,并重命名为您的项目(或将所有文件复制到空的项目目录)。

3.通过 composer 进入到项目目录,运行composer install命令。

然后按照指南进行所有操作即可顺利安装 luya 框架。