6
votes

I am trying to install symfony 2.4.1 from a composer.json file using the following command:

php composer.phar install

I run this command from the root directory which contains the composer.json file (var/www/projectname/)

A few packages are installed correctly. When installing the Doctrine package, I get the following error:

InvalidArgumentException $from (/var/www/projectname/bin/doctrine) and $to () must be absolute paths.

This is what i already tried:

  • running php composer.phar selfupdate (now newest version)
  • running php composer.phar update
  • running php composer.phar install

Removed whole project (including composer.json) and ran a new install using composer.phar create-project symfony/framework-standard-edition /var/www/[PROJECTNAME] 2.4.* --prefer-dist

one adition: I use vagrant using virtual box with a windows 7 share. And I'm running the commands through ssh.

Here you'll find the error report http://pastebin.com/rFk4vfnL

This is the output of php --version:

PHP 5.3.10-1ubuntu3.9 with Suhosin-Patch (cli) (built: Dec 12 2013 04:27:25)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
3
It's a unix/linux guest on a Windows 7 host?Jasper N. Brouwer
Could you show us the output of php --version and php --re. Thanks!Lars Strojny
@JasperN.Brouwer Vagrant / Virtualbox is running on a Windows 7 machine. see original post for more info about phpArthur

3 Answers

7
votes

Please delete composer's cache (~/.composer/cache/) and try again.

Also:

  • Are you using the latest version? (composer.phar selfupdate)
  • Are you running composer as a user that has write privileges on everything inside /var/www/projectname/?

update

Composer wants to symlink the doctrine script into your bin directory, and it seems findShortestPath() doesn't receive the correct paths when called. I've never seen this happen before :(

If I understand correctly, you're running composer inside a "synced folder" in a Vagrant guest:

  1. Why are you running composer on the guest, and not on the host?
  2. Can you try running composer (installing your project) somewhere else on the guest? (not in a synced folder) That way you can rule out if it has something to do with that Windows 7 share.

update

So the problem is running composer in a synced folder on a Windows 7 host. The next step is to get composer's source and debug the LibraryInstaller::installBinaries() method. Begin by checking if realpath($binPath) here doesn't return false or something like that.

But I have to ask again: why are you doing it this way? Usually one sets up a Vagrant box with synced folders to be able to develop on the host, and run it on the guest (which mimics the production server). So normally one would run composer on the host, not the guest...

0
votes

Try to use this install instruction with more parameters:

$ php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.4.1
0
votes

From what I can tell (based on the answer from @jasper) there is an issue with composer creating the symlink to your bin folder... This is probably due to the filesystem not supporting symlinks (the host's filesystem, which is then shared with the guest), a good test would be to try and run vagrant on a Linux box and see if the problem persists.

The only way I can think to solve this would be to install the dependencies globally inside the guest (which kinda defeats the point of using Vagrant).

Please note I do not have a windows machine to test on, but the symlink issue has caught me out before when using a samba share and NTFS/FAT32 file system.