简体   繁体   中英

Creating Symfony 5 skeleton entity - maker bundle not working

I'm trying to run

make:entity

But I receive an error:

There are no commands defined in the "make" namespace

You may be looking for a command provided by the "MakerBundle" which is currently not installed. Try running "composer require symfony/maker-bundle --dev"

I follow that advise and install the bundle by doing:

composer require symfony/maker-bundle --dev

It installs successfully: 在此处输入图片说明

And yet when I try to run make:entity I get exactly the same error:

在此处输入图片说明

There are no commands defined in the "make" namespace

You may be looking for a command provided by the "MakerBundle" which is currently not installed. Try running "composer require symfony/maker-bundle --dev"

What am I missing?

When you require a package using the --dev flag, the package will be installed as a development package.

These are packages that should not be enabled on production, when your application is actually deployed. They have to be installed on your development machine, and on your development machine only.

If you check your bundles.php file you'll see this line:

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

This ensures that the bundle is only enabled when your APP_ENV variable is set to dev .

Since you are running your application on production mode, the bundle is not enabled.

Just change your APP_ENV to dev so that the package is enabled, and you'll be able to run make commands.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM