NicklasWallgren / PokemonGoAPI-PHP

Pokemon Go API PHP library
BSD 2-Clause "Simplified" License
130 stars 51 forks source link

error on composer require nicklasw/pkm-go-api. #95

Closed milowei closed 8 years ago

milowei commented 8 years ago

How to fix this?

Root package 'nicklasw/pkm-go-api' cannot require itself in its composer.json Did you accidentally name your root package after an external package?

DrDelay commented 8 years ago

I think you are trying to require it in the very same package you obtained by cloning this from GitHub ;-) It does not make sense to require itself for composer obviously.

TacoBytes commented 8 years ago

I am also seeing the same message. DrDelay, not sure what you mean by "trying to require it in the very same package you obtained by cloning." I performed the following steps:

From the Windows Command Prompt:

  1. git clone https://github.com/NicklasWallgren/PokemonGoAPI-PHP.git
  2. cd PokemonGOAPI-php
  3. composer require nicklasw/pkm-go-api

Then I get the error milowei mentioned above.

Additionally, the "vendor" folder never gets created.

DrDelay commented 8 years ago
  1. Go to your project directory (can be empty) (Don't clone it!)
  2. Type composer require nicklasw/pkm-go-api (or create composer.json with min-stability: dev first if it complains about it)
  3. This repo will be in /vendor, require vendor/autoload.php in your project
TacoBytes commented 8 years ago

DrDelay. I did those steps and still have the same error. What I did to get around this error is I changed the name in the composer.json file to "pkm-go-api" and that seem to work as far as getting the dependencies and files.

Now I am tackling issue #75 Fatal error: Uncaught Error: Class 'NicklasW\PkmGoApi\Authenticators\Factory' not found

DrDelay commented 8 years ago

OK, the Authenticators\Factory-error is something else, I won't look into that right now.

But, again, I don't believe you did those steps. If you did them, you wouldn't have a composer.json with name nicklasw/pkm-go-api in your directory. Now you probably have the repo twice, once in your project root AND once in your /vendor, where the first one won't receive updates via composer.

I can't believe I did a video for that: https://gfycat.com/QualifiedSpeedyDiscus

NicklasWallgren commented 8 years ago

@DrDelay Haha, can't be much clearer then that 👍

TacoBytes commented 8 years ago

@DrDelay Hands down. Thank you. I got it working with your example.

TacoBytes commented 8 years ago

@milowei follow the steps mentioned by @DrDelay in the video. Start from scratch (delete everything in your current directory). This is all you need.

Note: I am new to composer. The mistake I was making is cloning / downloading the entire project and then, from within the folder where the project was in, attempting to execute "composer require nicklasw/pkm-go-api"

NicklasWallgren commented 8 years ago

Resolved. Credits to @DrDelay for the clip.

ghost commented 5 years ago

i am afraid you are trying to obtain a same package name with your project . make sure they are different