symfony / maker-bundle

Symfony Maker Bundle
https://symfony.com/
MIT License
3.35k stars 405 forks source link

Maker Bundle is not registering `make` commands #100

Closed thasmo closed 6 years ago

thasmo commented 6 years ago

Maker Bundle is not registering make commands, although I've followed the instructions in the docs carefully.

> composer create-project symfony/skeleton my-app
> cd my-app
> composer require maker --dev
> php bin/console list make

Symfony 4.0.2 (kernel: src, env: local, debug: true)

Usage:
command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -e, --env=ENV         The environment name [default: "local"]
      --no-debug        Switches off debug mode
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

2017-12-25T15:41:30+01:00 [error] Error thrown while running command "list make". Message: "There are no commands defined in the "make" namespace."

There are no commands defined in the "make" namespace.

list [--raw] [--format FORMAT] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<namespace>]

uname: CYGWIN_NT-10.0 (Windows 10) php -v: PHP 7.1.3 (cli) (built: Mar 14 2017 23:33:35) ( NTS MSVC14 (Visual C++ 2015) x64 ) composer --version: Composer version 1.5.6 2017-12-18 12:09:18

Also, it says env: local although APP_ENV=dev is set in .env.

weaverryan commented 6 years ago

Hey there!

Yea, I think that env local part is your issue: it means your app is running in a non-existent “local” environment, and MakerBundle only runs in dev. Are you on Homestead or on a machine that also runs Laravel apps? Something is setting the APP_ENV environment variable and that’s borking things :)

thasmo commented 6 years ago

Hey! Thanks for the hint, that actually got me on the right track. I somehow had an old APP_ENV=local line in my .zprofile file. Thanks! :)

ghost commented 6 years ago

@weaverryan I have the same problem and i'm in dev env...

I use Homestead but not Laravel apps or anything else, just this project. I need to install Doctrine to have the make command.


$ composer require symfony/maker-bundle --dev

$ php bin/console

Symfony 4.0.6 (kernel: src, env: dev, debug: true)

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -e, --env=ENV         The Environment name. [default: "dev"]
      --no-debug        Switches off debug mode.
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  about                   Displays information about the current project
  help                    Displays help for a command
  list                    Lists commands
 assets
  assets:install          Installs bundles web assets under a public directory
 cache
  cache:clear             Clears the cache
  cache:pool:clear        Clears cache pools
  cache:pool:prune        Prune cache pools
  cache:warmup            Warms up an empty cache
 config
  config:dump-reference   Dumps the default configuration for an extension
 debug
  debug:autowiring        Lists classes/interfaces you can use for autowiring
  debug:config            Dumps the current configuration for an extension
  debug:container         Displays current services for an application
  debug:event-dispatcher  Displays configured listeners for an application
  debug:router            Displays current routes for an application
 lint
  lint:yaml               Lints a file and outputs encountered errors
 router
  router:match            Helps debug routes by simulating a path info match
 security
  security:check          Checks security issues in your project dependencies
mehranhadidi commented 6 years ago

I have the same problem. Any solution?

weaverryan commented 6 years ago

If the bundle is added to your kernel (which is automatic in Symfony 4 + Flex), the commands will be available. If they are not there, the bundle is (for some reason) not registered with your kernel.

ghost commented 6 years ago

I used sf4 and flex. No make command :/

weaverryan commented 6 years ago

Check your bundles.php file - it should have been added there automatically on install.

vrkansagara commented 6 years ago

Just try to add bellow line in AppKernel.php under dev section


            if ('dev' === $this->getEnvironment()) {
               ...... 
               $bundles[] = new \Symfony\Bundle\MakerBundle\MakerBundle();
              ......
            }
methodeprog commented 5 years ago

Look in your .env file, on local APP_ENV is set on prod

AtefZoiaidi commented 5 years ago

Try this "composer require symfony/maker-bundle --dev"

shanjock commented 4 years ago

after executing composer require symfony/maker-bundle restart / open new command prompt or terminal and try php bin/console

mohamedhafezqo commented 3 years ago

In bundles.php append the below line Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],

sainagendrak commented 3 years ago
  1. Verify Your PHP Version
  2. Update composer to the latest (composer self-update) / composer update
  3. composer require symfony/maker-bundle:1.* --dev --ignore-platform-reqs verify your AppKernal.php file with below line.
  4. $bundles[] = new Symfony\Bundle\MakerBundle\MakerBundle(); in AppKernal.php file for dev environment.

@vrkansagara Thanks for the solution.

dlasserre commented 10 months ago

Change dev by local :

Symfony\Bundle\MakerBundle\MakerBundle::class => ['local' => true],