'Symfony there are no commands defined in the "make" namespace
Following the documentation found here I enter php bin/console make:entity Product
in Terminal and get the following error:
[Symfony\Component\Console\Exception\CommandNotFoundException]
There are no commands defined in the "make" namespace.
Solution 1:[1]
Maybe you were using the prod
environment?
The website-skeleton
puts the Maker Bundle in the require-dev
section of your composer.json
by default:
"require-dev": {
...
"symfony/maker-bundle": "^1.0",
...
}
If you've set APP_ENV=prod
in your .env
file and ran bin/console
it would ignore all dev
requirements and thus wouldn't enable the Maker Bundle.
Simply enabling the dev
environment again (APP_ENV=dev
) would do the trick then.
Solution 2:[2]
make
is a command of doctrine component. Just add doctrine maker.
composer require doctrine maker
https://symfony.com/doc/current/doctrine.html#installing-doctrine
Solution 3:[3]
You need Symfony 3.4 or higher. For Symfony 3.4 you will need to add it to the registerBundles function in config/AppKernerl():
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
// [...]
$bundles[] = new \Symfony\Bundle\MakerBundle\MakerBundle();
}
Bear in mind that the environment where it is installed is 'dev'.
Solution 4:[4]
try
composer remove maker
composer require maker --dev
and then
php bin/console make:entity Product
https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html
Solution 5:[5]
You must define the "dev" env in the command line :
php bin/console --env dev
php bin/console make:entity Product --env dev
Solution 6:[6]
I think you are in prod environment. Check if your the value of APP_ENV inside .env file is not equals to prod.
In case you generate a .env.local file, you have to delete it in your dev environment.
Solution 7:[7]
The problem just happend to me. I was in test environment. You have to be in dev environment.
Check APP_ENV value in .env file. It must be the following :
APP_ENV=dev
Solution 8:[8]
If you have installed symfony / maker-bundle for the dev mode you will only be able to use it for this mode. If you are in prod mode then go to dev mode and try again
Solution 9:[9]
Try composer require symfony/maker-bundle --dev
it work for me.
Solution 10:[10]
composer require symfony/maker-bundle --dev
Solution 11:[11]
To fix the problem you just create new project with (full properties), here is command for create a project:
symfony new --full project-name
after you create project like the command above, you now can able to use (make).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow