我得到“您的要求无法解决为一组可安装的软件包."当我运行作曲家更新时 [英] I get "Your requirements could not be resolved to an installable set of packages." when I run composer update
问题描述
我使用laravel 5.2编写了一个应用程序.这个程序有模块/包.所有软件包都将位于名为modules
的文件夹中.
I wrote a an app using laravel 5.2. This app have modules/package. all packages will be located in a folder called modules
.
我的第一个软件包位于一个名为modules/Mikea/Surveys
的文件夹中. Mikea
是供应商的名称,而Surveys
是模块/软件包的名称.每个程序包都有其自己的composer.json
文件,该文件允许我使用其自己的作曲家配置来配置每个程序包. (我目前有一个包裹,但以后可以有更多包裹)
My first package is located in a folder called modules/Mikea/Surveys
. Mikea
is the vendor's name and Surveys
is the module/package name. Each package has it's own composer.json
file which allows me to configure each package with it's own composer configs. ( I currently have one package but I can have more later)
在我的主要composer.json文件中,我使用的是路径" 类型在存储库部分中,就像您在以下composer.json文件中看到的一样
In my main composer.json file I am using "path" type in the repositories section like you see in the following composer.json file
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"laravelcollective/html": "5.2.x-dev",
"mikea/surveys": "*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"symfony/dom-crawler": "~3.0",
"symfony/css-selector": " ~3.0"
},
"repositories": [
{
"type": "path",
"url": "modules/Mikea/Surveys"
}
],
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/",
"Modules\\": "modules/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
在第二个composer.json文件包文件"中,我具有以下内容
in the second composer.json file "the package file" I have the following
{
"name": "mikea/surveys",
"type": "library",
"description": "Survey System",
"authors": [
{
"name": "Mike A",
"email": "some@email.com"
}
],
"repositories": [
{
"type": "package",
"package": {
"name": "mikea/surveys",
"version": "0.1.0",
"source": {
"type": "path",
"url": "modules/Mikea/Surveys"
}
}
}
],
"require": {
"php": ">=5.4.0"
},
"autoload": {
"classmap": [
"database/migrations",
"database/seeds"
],
"psr-4": {
"mikea\\Surveys\\": "src/"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
当我运行composer update
时,出现以下错误
when I run composer update
I get the following error
F:\xampp\htdocs\proj>composer update
> php artisan clear-compiled
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package mikea/surveys 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.
我在这里做错了什么?为什么会出现此错误?
what am I doing wrong here? Why do I get this error?
推荐答案
我相信我知道了.
我必须在第二个composer.json
文件中添加一个版本"标签,如下所示.至少添加版本"使我可以毫无错误地运行命令
I had to add a "version" tag in my second composer.json
file like so. At least adding the "version" allowed me to run the command with no errors
{
"name": "mikea/surveys",
"type": "library",
"description": "Survey System",
"version": "0.1.0",
"authors": [
{
"name": "Mike A",
"email": "some@email.com"
}
],
"require": {
"php": ">=5.4.0"
},
"autoload": {
"classmap": [
"database/migrations",
"database/seeds"
],
"psr-4": {
"mikea\\Surveys\\": "src/"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
这篇关于我得到“您的要求无法解决为一组可安装的软件包."当我运行作曲家更新时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!