在任何版本中都找不到 Composer 包
Composer package not found in any version
我正在尝试创建自定义供应商包,但尚未将包放在 packagist 上。根据文档,可以从 git (vcs) 而不是 packagist 加载包:https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository
yii2 项目(尽管不认为框架很重要)我在 vendor 文件夹中创建了包:
foundationize/yii2-foundation
(文件夹结构如上,我已经四重检查了)
我的根 public_html/composer.json 有以下条目:
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.5",
"yiisoft/yii2-swiftmailer": "*",
"foundationize/yii2-foundation": "dev-master"
},
我的包编写器文件,vendor/foundationize/yii2-foundation/composer.json 看起来像:
{
"name": "foundationize/yii2-foundation",
"description": "The Foundation extension for the Yii2 framework",
"keywords": ["yii2", "foundation"],
"type": "yii2-extension",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/foundationize/yii2-foundation/issues",
"wiki": "https://github.com/foundationize/yii2-foundation/wiki",
"source": "https://github.com/foundationize/yii2-foundation.git"
},
"authors": [
{
"name": "gvanto",
"email": "gvanto@hotmail.com",
"homepage": "http://foundationize.com"
}
],
"require": {
"yiisoft/yii2": "*"
},
"autoload": {
"psr-4": {
"foundationize\foundation\": ""
}
},
"repositories": [
{
"packagist": false,
"type": "vcs",
"url": "https://github.com/foundationize/yii2-foundation.git"
}
]
}
当我 运行 composer 安装(或更新)时,我不断收到以下错误消息:
Your requirements could not be resolved to an installable set of
packages.
Problem 1
- The requested package foundationize/yii2-foundation could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting see
https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion
for more details.
Read https://getcomposer.org/doc/articles/troubleshooting.md for
further common problems.
我用谷歌搜索了它的高低,阅读文档似乎无法让它工作(总是同样的错误,我实际上认为如果它说找不到包或者发现不正确的包版本)。
您必须将 repositories
条目添加到根 composer.json
文件中。否则,Composer 不知道去哪里搜索你的包。
自Laravel 5.5 版开始有包自动发现功能,因此无需添加服务提供商。您需要像这样注册包:
composer require barryvdh/laravel-debugbar:dev-master
您可以在这些文章中找到更多信息:
https://medium.com/@taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518
https://divinglaravel.com/laravels-package-auto-discovery
遇到了与此类似的问题,那是因为我在新 Drupal 结构的 /web 目录中 运行ning 作曲家。当我 运行 它在根目录时一切都很好。烦人的是,你需要运行 Drush in /web
我正在尝试创建自定义供应商包,但尚未将包放在 packagist 上。根据文档,可以从 git (vcs) 而不是 packagist 加载包:https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository
yii2 项目(尽管不认为框架很重要)我在 vendor 文件夹中创建了包:
foundationize/yii2-foundation (文件夹结构如上,我已经四重检查了)
我的根 public_html/composer.json 有以下条目:
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.5",
"yiisoft/yii2-swiftmailer": "*",
"foundationize/yii2-foundation": "dev-master"
},
我的包编写器文件,vendor/foundationize/yii2-foundation/composer.json 看起来像:
{
"name": "foundationize/yii2-foundation",
"description": "The Foundation extension for the Yii2 framework",
"keywords": ["yii2", "foundation"],
"type": "yii2-extension",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/foundationize/yii2-foundation/issues",
"wiki": "https://github.com/foundationize/yii2-foundation/wiki",
"source": "https://github.com/foundationize/yii2-foundation.git"
},
"authors": [
{
"name": "gvanto",
"email": "gvanto@hotmail.com",
"homepage": "http://foundationize.com"
}
],
"require": {
"yiisoft/yii2": "*"
},
"autoload": {
"psr-4": {
"foundationize\foundation\": ""
}
},
"repositories": [
{
"packagist": false,
"type": "vcs",
"url": "https://github.com/foundationize/yii2-foundation.git"
}
]
}
当我 运行 composer 安装(或更新)时,我不断收到以下错误消息:
Your requirements could not be resolved to an installable set of packages.
Problem 1 - The requested package foundationize/yii2-foundation could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion for more details.
Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.
我用谷歌搜索了它的高低,阅读文档似乎无法让它工作(总是同样的错误,我实际上认为如果它说找不到包或者发现不正确的包版本)。
您必须将 repositories
条目添加到根 composer.json
文件中。否则,Composer 不知道去哪里搜索你的包。
自Laravel 5.5 版开始有包自动发现功能,因此无需添加服务提供商。您需要像这样注册包:
composer require barryvdh/laravel-debugbar:dev-master
您可以在这些文章中找到更多信息:
https://medium.com/@taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518 https://divinglaravel.com/laravels-package-auto-discovery
遇到了与此类似的问题,那是因为我在新 Drupal 结构的 /web 目录中 运行ning 作曲家。当我 运行 它在根目录时一切都很好。烦人的是,你需要运行 Drush in /web