我正在尝试使用以下命令安装我的作曲家包:
composer install --no-dev --no-scripts
composer.json
文件看起来像这样(它与标准的Laravel编写器文件非常相似):
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"doctrine/dbal": "^2.5",
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*",
"laravel/homestead": "^5.2",
"barryvdh/laravel-ide-helper": "^2.3"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
但是当我尝试在我的生产机器上安装它时(在版本v5.5.9
上运行PHP)我收到以下错误:
您的要求无法解析为可安装的软件包。
Problem 1
- laravel/homestead v5.4.0 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead v5.3.2 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead v5.3.1 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead v5.3.0 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead v5.2.4 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead v5.2.1 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead v5.2.0 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead 5.2.3 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- laravel/homestead 5.2.2 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
- Installation request for laravel/homestead ^5.2 -> satisfiable by laravel/homestead[5.2.2, 5.2.3, v5.2.0, v5.2.1, v5.2.4, v5.3.0, v5.3.1, v5.3.2, v5.4.0].
所以我的问题如下:
--no-dev
并且宅基地是开发包时,为什么宅基地甚至被安装?答案 0 :(得分:0)
--no-dev
不应安装dev依赖项。检查生产构建脚本(或者您在生产时运行此脚本时使用的任何脚本),确实添加了--no-dev
。
对于问题的第二部分,您可以通过将laravel/homestead
包版本更改为~4.0
或4.0.5
来更准确地使其与您的php版本兼容,从而避免错误。