martinnc
martinnc

Reputation: 189

'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).

Upvotes: 7

Views: 7198

Answers (4)

zall talla
zall talla

Reputation: 1

When you're using symfony 5.1, you've to execute this following command:

symfony server:start -d

Upvotes: 0

lamine ahmed
lamine ahmed

Reputation: 11

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.

Upvotes: 1

Fabio Cordeiro
Fabio Cordeiro

Reputation: 31

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

Upvotes: 3

martinnc
martinnc

Reputation: 189

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.

Upvotes: 9

Related Questions