4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

VirtualBoxで共有したディレクトリは厄介...?

Posted at

ある日のこと。
Composerを使いSmartyを入れようと思ったのですが、何度やってもメッチャクチャ時間がかかった挙句エラーになり、Smartyを入れることができませんでした。

共有フォルダー機能を使うと、Mac上のフォルダーにゲストOSからアクセスができるので、

  • ソースはMacで書く
  • サーバはぶっ壊してもいいお試しで色々入れたりできるようにゲストOS

といった時に便利なのです。

しかし、この時はまだあんな恐ろしい罠が待ち構えているとは…誰一人知らなかったのだ… (大袈裟。)
##環境

  • MacBook Pro Retina (late 2010) OS X 10.9
  • VirtualBox 4.3.4
  • CentOS 6.5 i386
  • PHP 5.5.7
  • Composer 43fde9177ededc627d3f6392f996b093410e1036 2013-12-05 15:29:59
  • Subversion 1.7.4

##再現手順

  1. Mac上のフォルダを適当に共有する
  2. 共有したフォルダをCentOS上にマウント
  3. マウントしたフォルダ上でcomposer install
composer.json
{
    "require": {
        "smarty/smarty": "3.*"
    }
}

##実行してみると…

[root@centos application]# date
2014年  1月  1日 水曜日 12:25:26 JST

[root@centos application]# composer -vvv install
Reading ./composer.json
Executing command (CWD): git describe --exact-match --tags
Executing command (CWD): git branch --no-color --no-abbrev -v
Executing command (CWD): hg branch
Loading composer repositories with package information
Downloading https://packagist.org/packages.json
Writing /root/.composer/cache/repo/https---packagist.org/packages.json into cache
Reading /root/.composer/cache/repo/https---packagist.org/p-provider-active.json from cache
Reading /root/.composer/cache/repo/https---packagist.org/p-provider-archived.json from cache
Reading /root/.composer/cache/repo/https---packagist.org/p-provider-latest.json from cache
Reading /root/.composer/cache/repo/https---packagist.org/p-provider-stale.json from cache
Installing dependencies (including require-dev)
Reading /root/.composer/cache/repo/https---packagist.org/provider-smarty$smarty.json from cache
  - Installing smarty/smarty (v3.1.16)
    Checking out /tags/v3.1.16/@4802
A    vendor/smarty/smarty/composer.json
A    vendor/smarty/smarty/distribution
A    vendor/smarty/smarty/distribution/change_log.txt
A    vendor/smarty/smarty/distribution/demo
A    vendor/smarty/smarty/distribution/demo/templates_c

(中略)
                                                                               
  [RuntimeException]                                                           
  Package could not be downloaded, A    vendor/smarty/smarty/composer.json     
  A    vendor/smarty/smarty/distribution                                       
  A    vendor/smarty/smarty/distribution/change_log.txt                        
  A    vendor/smarty/smarty/distribution/demo                                  
  A    vendor/smarty/smarty/distribution/demo/templates_c                      


(中略)
                                                                               
Exception trace:
 () at phar:///usr/local/bin/composer.phar/src/Composer/Downloader/SvnDownloader.php:84
 Composer\Downloader\SvnDownloader->execute() at phar:///usr/local/bin/composer.phar/src/Composer/Downloader/SvnDownloader.php:33
 Composer\Downloader\SvnDownloader->doDownload() at phar:///usr/local/bin/composer.phar/src/Composer/Downloader/VcsDownloader.php:59
 Composer\Downloader\VcsDownloader->download() at phar:///usr/local/bin/composer.phar/src/Composer/Downloader/DownloadManager.php:180
 Composer\Downloader\DownloadManager->download() at phar:///usr/local/bin/composer.phar/src/Composer/Installer/LibraryInstaller.php:155
 Composer\Installer\LibraryInstaller->installCode() at phar:///usr/local/bin/composer.phar/src/Composer/Installer/LibraryInstaller.php:86
 Composer\Installer\LibraryInstaller->install() at phar:///usr/local/bin/composer.phar/src/Composer/Installer/InstallationManager.php:153
 Composer\Installer\InstallationManager->install() at phar:///usr/local/bin/composer.phar/src/Composer/Installer/InstallationManager.php:140
 Composer\Installer\InstallationManager->execute() at phar:///usr/local/bin/composer.phar/src/Composer/Installer.php:510
 Composer\Installer->doInstall() at phar:///usr/local/bin/composer.phar/src/Composer/Installer.php:210
 Composer\Installer->run() at phar:///usr/local/bin/composer.phar/src/Composer/Command/InstallCommand.php:110
 Composer\Command\InstallCommand->execute() at phar:///usr/local/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:897
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:191
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer.phar/src/Composer/Console/Application.php:117
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:121
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer.phar/src/Composer/Console/Application.php:83
 Composer\Console\Application->run() at phar:///usr/local/bin/composer.phar/bin/composer:43
 require() at /usr/local/bin/composer.phar:15


install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader]


[root@centos application]# date
2014年  1月  1日 水曜日 12:27:08 JST

あ、あんまり時間かかってない…
SSDすげーな。。。
会社のHDDなパソコンでやった時は時間計ってないけどもっと時間かかったぞ…。

というわけで、svn checkoutの途中でエラーになってしまいます。

##で、困ったときの…?
たすけて!すたっくおーばーふろーせんせー!
[RuntimeException] Package could not be downloaded for smarty · Issue #2352 · composer/composer · GitHub

I found the reason. Filesystem was mounted via vboxsf and svn checkout fails each time. After i moved all data to local disk it was fixed.

ありました、ありましたよ。
まさにComposer & Smarty & VirtualBoxなときの回答が。
さすがすたっくおーばーふろーせんせー。わかってらっしゃる。

##というわけで。

  • 上記のとおり、VirtualBoxの共有フォルダー以外のフォルダーでcomposer installを実行し、それを煮るなり焼くなりする。 (っんぁ・・・・?!!!?中はらめっ!!!!!らめなのぉお …おっと誰か来たようだ)
  • ホストオンリーアダプターを作ってsambaでCentOSの/をpublicにし、smb経由でソースをぶちこむ。

あたりで幸せになれるんじゃないでしょうか。
ボクは1つ目の方法にしました。

4
5
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
4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?