Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer install doesn't work #1503

Closed
stephen-leavitt-sonyatv-com opened this issue Nov 12, 2014 · 4 comments
Closed

Composer install doesn't work #1503

stephen-leavitt-sonyatv-com opened this issue Nov 12, 2014 · 4 comments

Comments

@stephen-leavitt-sonyatv-com

Installing by adding phpunit to the require-dev section of composer.json does not seem to work.

"require-dev": {
    "phpunit/phpunit": "4.3.*"
}

This currently attempts to pull in phpunit 4.3.5. The composer.json file specifies that there is a binary for phpunit in the bin-dir (bin/phpunit), but the code for phpunit in GitHub does not contain such a directory, much less a phpunit file in that directory. Thus, when it attempts to symlink it into bin/phpunit on the project level, it fails since there is no file to symlink in the first place.

This is on an Ubuntu Linux system, using the latest composer PHAR, as the ErrorException thrown is on line 246 of src/Composer/Installer/LibraryInstaller.php, and the error message is "file_put_contents(/xxxxxx/bin/phpunit): failed to open stream: No such file or directory" (the project directory path is not xxxxxx, it has been redacted).

Thanks.

@sebastianbergmann
Copy link
Owner

Not sure what your problem is:

$ cat composer.json 
{
    "require-dev": {
        "phpunit/phpunit": "4.3.*"
    }
}

$ php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing sebastian/version (1.0.3)
    Loading from cache

  - Installing sebastian/exporter (1.0.2)
    Loading from cache

  - Installing sebastian/environment (1.2.0)
    Loading from cache

  - Installing sebastian/diff (1.2.0)
    Loading from cache

  - Installing sebastian/comparator (1.0.1)
    Loading from cache

  - Installing symfony/yaml (v2.5.6)
    Loading from cache

  - Installing doctrine/instantiator (1.0.4)
    Loading from cache

  - Installing phpunit/php-text-template (1.2.0)
    Loading from cache

  - Installing phpunit/phpunit-mock-objects (2.3.0)
    Loading from cache

  - Installing phpunit/php-timer (1.0.5)
    Loading from cache

  - Installing phpunit/php-file-iterator (1.3.4)
    Loading from cache

  - Installing phpunit/php-token-stream (1.3.0)
    Loading from cache

  - Installing phpunit/php-code-coverage (2.0.11)
    Loading from cache

  - Installing phpunit/phpunit (4.3.5)
    Downloading: 100%         

phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
Writing lock file
Generating autoload files

$ ./vendor/bin/phpunit --version
PHPUnit 4.3.5 by Sebastian Bergmann.

@stephen-leavitt-sonyatv-com
Copy link
Author

My apologies on the assumption of the need for the bin directory in your project. I did notice this morning the phpunit file in the root of the phpunit repository, so my assumption there is not correct; many apologies. However, I am still encountering the same problem. However, since you are able to get it installed properly using composer install, I will close this ticket, as the basis for it is an incorrect assumption. If I resolve my problem and discover the source of it, I will open or reopen as appropriate if the issue is in fact related to phpunit. Thanks.

@stephen-leavitt-sonyatv-com
Copy link
Author

I think I have discovered the source of my problem. composer.json had an entry as follows:

"require-dev": {
    "phpunit/phpunit": "~3.7"
}

And bin/phpunit was a symlink that pointed to ../vendor/phpunit/phpunit/composer/bin/phpunit.

composer install was not updating that symlink, and when it tried to update the contents of bin/phpunit, which was a broken symlink, it failed and then tried to update via using the createUnixyProxy method, which also failed due to the broken symlink. It appears that the change in where the phpunit binary from 3.7 to 4.0 potentially confused composer, though I think composer should be able to gracefully handle the need to update a broken symlink in the bin folder better than what it does currently.

Thanks, and I'm sorry for the false report.

@helhum
Copy link
Contributor

helhum commented Apr 13, 2015

Thank you very much for the bug report though, as I ran into the exact same issue today and was able to resolve it by removing the bin dir…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants