cakephp / bake

The Bake Command Plugin
Other
110 stars 101 forks source link

Unknown command cake bake #458

Closed armandohackcode closed 6 years ago

armandohackcode commented 6 years ago

Tengo problemas al crear el model con bin/cake bake nombre Me sale : Exception: unknown command 'cake bake ' . Run cake -- help to get the list of valid commands in /var/www/html/congress/vendor/cakephp/cakephp/src/console/CommandRunner.php line 321

markstory commented 6 years ago

Have you ensured that bake is installed? Try running composer require cakephp/bake which will install bake.

armandohackcode commented 6 years ago

En un princio bin/cake bake model funcionaba correctamente. Solo que tube que hacer algunos cambios en la base de datos. Y ahora pretendo remodelar con bake model para que se se modele los cambios de la base de datos. Pero ahora me sale ese error y no entiendo el problema ya que no reconoce el comando ya intente el composer update composer install y nada

markstory commented 6 years ago

Does cake -h show any of bake's commands in the output?

dereuromark commented 6 years ago

You need to run bin/cake ... This is not a bug of the plugin, but a user error. Closing as such.

If you are looking for help on how to implement a feature or to better understand how to use the framework correctly, please visit one of the following:

The CakePHP Manual The CakePHP online API The CakePHP Forum Stackoverflow

or the #cakephp channel on irc.freenode.net, where we will be more than happy to help answer your questions.

Thanks!

danny3b commented 6 years ago

I have the same problem after fresh installation.

I'm typing bin/cake bake ... and I'm getting error: Exception: Unknown command cake bake. Run cake --help to get the list of valid commands.

--help returns:

Available Commands:

So there is no bake command available at all.

ADmad commented 6 years ago

I just did a test using latest app skeleton installing it using composer create-project cakephp/app myapp.

After that running bin/cake bake from the folder gives me expected output:

The following commands can be used to generate skeleton code for your application.

Available bake commands:

- all
- behavior
- cell
- command
- component
- controller
- fixture
- form
- helper
- mailer
- middleware
- migration
- migration_diff
- migration_snapshot
- model
- plugin
- seed
- shell
- shell_helper
- task
- template
- test
- twig_template

By using `cake bake [name]` you can invoke a specific bake task.
davidxwheatley commented 6 years ago

Experiencing same problem Updated CakePHP 3.6.11. From CakePHP 3.5.*. using composer update. Installed as expected no errors.

bin/cake bake .... Not available: ERROR: Exception: Unknown command cake bake. Run cake --help to get the list of valid commands.

bin/cake -h

Available Commands:

davidxwheatley commented 6 years ago

UPDATE - Using ADmad suggestion above - Created a new project from scratch composer create-project cakephp/app myapp ... this worked bin/cake bake is available.

dereuromark commented 6 years ago

Make sure the plugin is installed via composer and loaded properly as documented. Then it will also work for upgraded apps.

davidxwheatley commented 6 years ago

Cheers Mark .... Appreciate quick response.

Back-Sephiroth commented 5 years ago

Hello,

I have the same problem, and i can't find how resolve this one.

When i run cake --help => bake isn't displayed

i've tried remove and required the composer command and this not resolved the problem.

Have you any other suggestions ?

thanks

dereuromark commented 5 years ago

Did u load the plugin as documented? e.g. in Application.php?

Back-Sephiroth commented 5 years ago

no, i don't,

Where it is documented, because in other project, i haven't need to configure it.

Back-Sephiroth commented 5 years ago

i found the solution after create a new project, the Application.php file :

public function bootstrap()
    {
        // Call parent to load bootstrap from files.
        parent::bootstrap();

        if (PHP_SAPI === 'cli') {
            try {
                $this->addPlugin('Bake');
            } catch (MissingPluginException $e) {
                // Do not halt if the plugin is missing
            }

            $this->addPlugin('Migrations');
        }

        /*
         * Only try to load DebugKit in development mode
         * Debug Kit should not be installed on a production system
         */
        if (Configure::read('debug')) {
            $this->addPlugin(\DebugKit\Plugin::class);
        }
    }

This code doesn't exists in my project, so when i duplicate it, the problem is resolved.

Thanks for your help.

Regards.