我正在使用 Laravel 5.2.23 并且无法引入我的新包 bsapaka/metattribute .我得到异常:
[InvalidArgumentException]
Could not find package bsapaka/metattribute at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability
Composer 似乎有它:
运行 composer show bsapaka/metattribute
返回:
name : bsapaka/metattribute
descrip. : classes for Laravel attributes
keywords : attribute, attributes, properties, alias, meta attribute
versions : dev-master
type : library
(more)
所以我想知道我是否在 composer.json
中遗漏了什么:
{
"name": "bsapaka/metattribute",
"type": "library",
"description": "classes for Laravel attributes",
"keywords": [
"attribute",
"attributes",
"properties",
"meta attribute",
"alias"
],
"homepage": "https://github.com/bsapaka/metattribute",
"license": "MIT",
"require": {
"illuminate/support": "~5.1",
"php" : "~5.5|~7.0"
},
"require-dev": {
"phpspec/phpspec": "~2.2"
},
"autoload": {
"psr-4": {
"bsapaka\\metattribute\\": "src/"
}
},
"minimum-stability": "stable"
}
我做了很多文档阅读、故障排除、添加 mininum-stability
、检查版本控制、与其他包进行比较、验证 JSON、寻找我遗漏的花絮等,并在在这一点上,我真的可以在我可能出错的地方使用一些指导。感谢阅读,感谢您的帮助。
最佳答案
您在 GitHub 上的 master
分支中没有定义任何版本标签。
如果没有版本标签,那么 Composer 就不知道哪个版本是稳定的。所以如果你在项目中有 "minimum-stability": "stable"
需要你自己制作的包,它找不到任何稳定的版本。
在 GitHub 上的 master 分支中创建一个新标签(例如 1.0.0)以声明最新提交是稳定的或使用 dev-master
版本和 “minimum-stability”: "dev"
在需要您自制包的项目中。
关于php - 为什么 Composer 无法找到/安装我的 Laravel 5.2 包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36003465/