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

Requiring a private git Bitbucket repository fails to find valid composer.json #2418

Closed
mcfdn opened this issue Nov 13, 2013 · 7 comments
Closed

Comments

@mcfdn
Copy link

mcfdn commented Nov 13, 2013

I'm trying to reference a private git repository from Bitbucket in my project's composer.json:

{
    "require": {
        "vendor/my-private-package": "dev-master"
    },
    "repositories": [
        {
            "type": "git",
            "url": "git@bitbucket.org:vendor/my-private-package.git"
        }
    ]
}

The remote repository has the following composer.json:

{
    "name": "vendor/my-private-package",
    "autoload": {
        "psr-0": {
            "NS_": "src/"
        }
    }
}

I'm receiving the following error:

[Composer\Repository\InvalidRepositoryException]
No valid composer.json was found in any branch or tag of git@bitbucket.org:vendor/my-private-package.git, could not load a package from it.

Is this expected behavior? My understanding is that I should just be able to reference a remote git repository and have composer install it with or without a remote composer.json.

@Seldaek
Copy link
Member

Seldaek commented Nov 13, 2013

Can you run it with -v? then it should say why the branches/tags were ignored, it should help debugging this.

@mcfdn
Copy link
Author

mcfdn commented Nov 13, 2013

Ok I've discovered the issue, and it's a strange one. I had updated my windows registry to change directory and print out a message at command prompt startup.

Running composer update -v :

Skipped parsing master, ""master":composer.json" does not contain valid JSON
Parse error on line 1:
Autorun message
-^
Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['

[Composer\Repository\InvalidRepositoryException]
No valid composer.json was found in any branch or tag of git@bitbucket.org:vendor/my-private-package.git, could not load a package from it.

It seems to be including that autorun message in the stream..

I've removed the registry entry and it seems to be working now. I'm not sure if this can be considered a bug as it's quite a weird case.

EDIT:

I just want to add that any registry entry (not just an echo) will cause the error I noted in the first comment. For example I have an entry that runs CD C:\ on startup and I'm now still receiving the error!

@Seldaek
Copy link
Member

Seldaek commented Nov 13, 2013

Yeah it's not really a composer issue it's just the way windows cmd works, if you have any autorun entry it messes things up for php run processes or at least the way we run them they go through a shell and that stuff gets executed. Autorun entries should really be silent.

@aldee07
Copy link

aldee07 commented Jan 3, 2017

I know this is a bit old, but for some that might encounter this issue, this is how it works for me.

Clear the composer cache.

composer clearcache

Rerun the satis build script.

@hisenbergguj
Copy link

@aldee07 it doesnt work for me any otheridea?

can you post your private package JSON file?

@jUnG3
Copy link

jUnG3 commented Dec 13, 2017

@aldee07
Thx for the idea. I encountered the same problem and the composer clearcache command helped.

@bradleygreen
Copy link

'composer self-update' seems to have solved the problem for me. I did try 'composer clearcache' first, and also tried deleting C:\users\username\AppData\Local\Composer*.

The suggestions I found didn't seem to work for me, but updating my composer did. Best of luck to you all!

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

6 participants