2017-07-04 38 views
0

我嘗試使用下面的命令來安裝我的作曲家的包:作曲家使用宅基地給出錯誤安裝「你的要求不能被解析到一個安裝包集合」

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" 
    } 
} 

然而,當我嘗試我的生產機器(運行PHP上v5.5.9我收到以下錯誤版本上安裝它:

您的需求無法解析爲可安裝的一組軟件包。

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和宅基地是一個開發包?
  • 如果我確實想在我的生產機器上安裝Homestead,我該如何解決上述問題?

回答

0

--no-dev不應該安裝dev依賴項。檢查你的生產構建腳本(或者你用來在生產環境中運行的腳本),確實增加了--no-dev

對於您的問題的第二部分,您可以通過將laravel/homestead程序包版本更改爲~4.04.0.5以更準確地使其與您的php版本兼容來避免該錯誤。

+0

我瞭解開發依賴不應該安裝。那爲什麼呢?我沒有看到爲什麼它應該這樣做,我還添加了'--no-scripts' –

+0

我測試了完全相同的'composer.json',並且它沒有安裝任何開發依賴項。即使在開發機器上,你是否得到這個錯誤? – ayip

+0

不在開發機器上因爲我在dev上使用PHP的更高版本。 –

相關問題