Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Composer require server --dev' not working (Symfony docs)

I'm new to Symfony and I'm following a couple of quick introductions on the Symfony website: the quick tour and installation guide. Both say you can install a server using:

composer require server --dev

When I run this command I get:

 [InvalidArgumentException]
  Could not find package server.

  Did you mean one of these?
      react/http
      react/socket
      cboden/ratchet
      voryx/thruway
      laravel/passport


require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

Okay, I can ignore this and use another local server, but I wondered if I was doing something wrong or if the documentation is out of date? Composer is installed fine on my machine (a Mac).

like image 582
martinnc Avatar asked Mar 08 '18 11:03

martinnc


3 Answers

So the answer is: I wasn't in the 'quick_tour' directory that is created in the quick tour tutorial. It doesn't actually say to cd into that, but I suppose I should have guessed! After you cd into that the command works fine.

like image 132
martinnc Avatar answered Nov 19 '22 18:11

martinnc


I had the same problem. You need to cd in the project directory before running the composer again. This resolved the error for me.

like image 44
Fabio Cordeiro Avatar answered Nov 19 '22 19:11

Fabio Cordeiro


To fix the mistake, you must change your directory in the new file of your project and after it's running, you must give the correct route of the new file of the project created by composer.

 composer create-project symfony/skeleton my-project

You must change directory with cd my-project to not stay in the previous directory when you had installed and created the file my-project.

like image 1
lamine ahmed Avatar answered Nov 19 '22 18:11

lamine ahmed