LoginSignup
11
13

More than 5 years have passed since last update.

Composerの実行が遅くて仕方がないのを早くする方法

Posted at

--prefer-distをオプションに指定するとgit cloneをしないでよいものはダウンロード済ませるので早くなる。フレームワーク(CakePHP)のダウンロード速度を特に改善する。デプロイにも適する。

普通にやるとCloneでタイムアウト

$ composer create-project -s dev cakephp/app cakephp3_study
Installing cakephp/app (dev-master 3a87494e5d01151983ddebe8961c134b04ff4c4c)
  - Installing cakephp/app (dev-master master)
    Cloning master

Created project in cakephp3_study
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing cakephp/plugin-installer (0.0.1)
    Downloading: 100%         

  - Installing aura/installer-default (1.0.0)
    Downloading: 100%         

  - Installing nesbot/carbon (1.13.0)
    Downloading: 100%         

  - Installing psr/log (1.0.0)
    Downloading: 100%         

  - Installing aura/intl (1.1.1)
    Downloading: 100%         

  - Installing ircmaxell/password-compat (v1.0.4)
    Downloading: 100%         

  - Installing cakephp/cakephp (3.0.x-dev d910e02)
    Cloning d910e02df686a6121ad6e21008d2f5a63be26e12
    Failed to download cakephp/cakephp from source: The process "git clone --no-checkout 'git://github.com/cakephp/cakephp.git' '/vagrant_data/cakephp3_study/vendor/cakephp/cakephp' && cd '/vagrant_data/cakephp3_study/vendor/cakephp/cakephp' && git remote add composer 'git://github.com/cakephp/cakephp.git' && git fetch composer" exceeded the timeout of 300 seconds.
    Now trying to download from dist
  - Installing cakephp/cakephp (3.0.x-dev d910e02)
    Downloading: 100%         

  - Installing cakephp/debug_kit (3.0.x-dev 4eef339)
    Cloning 4eef339a6832d121fa89f3b06982c7ff9ddaa879

  - Installing mobiledetect/mobiledetectlib (2.8.11)
    Downloading: 100%         

  - Installing d11wtq/boris (v1.0.8)
    Downloading: 100%         

Writing lock file
Generating autoload files
Created `config/app.php` file
Permissions set on /vagrant_data/cakephp3_study/tmp/cache
Permissions set on /vagrant_data/cakephp3_study/tmp/cache/models
Permissions set on /vagrant_data/cakephp3_study/tmp/cache/persistent
Permissions set on /vagrant_data/cakephp3_study/tmp/cache/views
Permissions set on /vagrant_data/cakephp3_study/tmp/sessions
Permissions set on /vagrant_data/cakephp3_study/tmp/tests
Permissions set on /vagrant_data/cakephp3_study/tmp
Permissions set on /vagrant_data/cakephp3_study/logs
Updated Security.salt value in config/app.php
Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]? n

--prefer-distありだと1分くらいで完了。

$composer create-project -s dev --prefer-dist cakephp/app cakephp3_study
Installing cakephp/app (dev-master 3a87494e5d01151983ddebe8961c134b04ff4c4c)
  - Installing cakephp/app (dev-master master)
    Downloading: 100%         

Created project in cakephp3_study
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing cakephp/plugin-installer (0.0.1)
    Loading from cache

  - Installing aura/installer-default (1.0.0)
    Loading from cache

  - Installing nesbot/carbon (1.13.0)
    Loading from cache

  - Installing psr/log (1.0.0)
    Loading from cache

  - Installing aura/intl (1.1.1)
    Loading from cache

  - Installing ircmaxell/password-compat (v1.0.4)
    Loading from cache

  - Installing cakephp/cakephp (3.0.x-dev d910e02)
    Loading from cache

  - Installing cakephp/debug_kit (3.0.x-dev 4eef339)
    Downloading: 100%         

  - Installing mobiledetect/mobiledetectlib (2.8.11)
    Loading from cache

  - Installing d11wtq/boris (v1.0.8)
    Loading from cache

Writing lock file
Generating autoload files
Created `config/app.php` file
Permissions set on /vagrant_data/cakephp3_study/tmp/cache
Permissions set on /vagrant_data/cakephp3_study/tmp/cache/models
Permissions set on /vagrant_data/cakephp3_study/tmp/cache/persistent
Permissions set on /vagrant_data/cakephp3_study/tmp/cache/views
Permissions set on /vagrant_data/cakephp3_study/tmp/sessions
Permissions set on /vagrant_data/cakephp3_study/tmp/tests
Permissions set on /vagrant_data/cakephp3_study/tmp
Permissions set on /vagrant_data/cakephp3_study/logs
Updated Security.salt value in config/app.php
11
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
13