Generate is not defined #713

Closed
anakinjay opened this Issue Jun 28, 2015 · 37 comments

Projects

None yet

7 participants

@anakinjay

Need some help, everything was working great on D8 beta 6. I just upgraded to beta 11 and tried to upgrade console to match, and now nothing works. Looks like it doesn't think I'm in my drupal root directory, but I absolutely am.

Executing commands from the drupal root folder"

drupal
Drupal Console version 0.7.14

Usage:
 command [options] [arguments]

Options:
 --help (-h)           Display this help message
 --quiet (-q)          Do not output any message
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)        Display this application version
 --ansi                Force ANSI output
 --no-ansi             Disable ANSI output
 --no-interaction (-n) Do not ask any interactive question
 --drupal (-d)         Path to Drupal root.
 --shell (-s)          Launch the shell.
 --env (-e)            The Environment name. (default: "prod")
 --no-debug            Switches off debug mode.
 --learning            Generate a verbose code output.

Available commands:
 help          Displays help for a command
 init          Copy configuration files to user home directory.
 list          Lists commands
 self-update   Update the console to latest version.

 In order to list all of the available commands, you should run this inside a drupal root directory.
drupal generate 



  [InvalidArgumentException]
  Command "generate" is not defined.


drupal generate -v



  [InvalidArgumentException]
  Command "generate" is not defined.



Exception trace:
 () at phar:///usr/local/bin/drupal/vendor/symfony/console/Symfony/Component/Console/Application.php:549
 Symfony\Component\Console\Application->find() at phar:///usr/local/bin/drupal/vendor/symfony/console/Symfony/Component/Console/Application.php:192
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/drupal/src/Console/Application.php:132
 Drupal\AppConsole\Console\Application->doRun() at phar:///usr/local/bin/drupal/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/drupal/bin/console.php:69
 require() at phar:///usr/local/bin/drupal/bin/console:3
 require() at /usr/local/bin/drupal:10
@anakinjay

I tried removing it from my bin folder and running the phar manually from my rocroot:

php console.phar generate -v



  [InvalidArgumentException]
  Command "generate" is not defined.



Exception trace:
 () at phar:///Users/ablosser/Sites/devdesktop/wvufscom-dev/docroot/console.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:549
 Symfony\Component\Console\Application->find() at phar:///Users/ablosser/Sites/devdesktop/wvufscom-dev/docroot/console.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:192
 Symfony\Component\Console\Application->doRun() at phar:///Users/ablosser/Sites/devdesktop/wvufscom-dev/docroot/console.phar/src/Console/Application.php:132
 Drupal\AppConsole\Console\Application->doRun() at phar:///Users/ablosser/Sites/devdesktop/wvufscom-dev/docroot/console.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at phar:///Users/ablosser/Sites/devdesktop/wvufscom-dev/docroot/console.phar/bin/console.php:69
 require() at phar:///Users/ablosser/Sites/devdesktop/wvufscom-dev/docroot/console.phar/bin/console:3
 require() at /Users/ablosser/Sites/devdesktop/wvufscom-dev/docroot/console.phar:10

@jmolivas
Member

Which OS are you using @anakinjay ?

Is Drupal already installed?

@anakinjay

I'm on Mac OSX Whatever the latest animal is. And yep, been using drupal console with D8 beta 6 for about 6 months with no problems. Updated my docroot to D8 Beta 11, and updated drupal console to latest to match it, and now I get this error.

@jmolivas
Member
jmolivas commented Jul 1, 2015

@anakinjay May you try on a new installation @anakinjay ?

$ drush dl drupal-8.0.0-beta11

$ cd drupal-8.0.0-beta11

$ drush si standard --db-url=mysql://DB_USER:DB_PASS@127.0.0.1/DB_NAME --site-name=SITE_NAME --account-name=ADMIN_NAME --account-pass=ADMIN_PASS --account-mail=EMAIL --yes

And then try drupal console on the new installed site

@jmolivas jmolivas added the bug label Jul 1, 2015
@ansorg
ansorg commented Jul 16, 2015

@anakinjay is this perhaps related to #755 ? I have similar errors

@laradevitt

Sorry to say, I am having this problem on a WAMP installation, latest D8 dev build (is that a no-no?). I am absolutely in root. Not a multisite. Here are the goods:

$ drupal --list
Drupal Console version 0.8.3

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
  -d, --drupal[=DRUPAL]   Path to Drupal root.
  -s, --shell             Launch the shell.
  -e, --env[=ENV]         The Environment name. [default: "prod"]
      --no-debug          Switches off debug mode.
      --learning          Generate a verbose code output.
  -v|vv|vvv, --verbose    Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
  -gc, --generate-chain   Print execution options and arguments as yaml output to be used in chain command
  -gi, --generate-inline  Print execution options and arguments as inline call to be use in the future

Available commands:
  help         Displays help for a command
  init         Copy configuration files to user home directory.
  list         Lists commands
  self-update  Update the console to latest version.
 site
  site:new     Create a new Drupal project
 yaml
  yaml:merge   Merge one or more YAML files in a new YAML file. Latest values are preserved.

 In order to list all of the available commands, you should run this inside a drupal root directory.

And more...

$ drupal generate:module



  [InvalidArgumentException]
  There are no commands defined in the "generate" namespace.


$ drupal generate -v



  [InvalidArgumentException]
  Command "generate" is not defined.



Exception trace:
 () at phar://C:/drupalconsole/drupal/vendor/symfony/console/Application.php:549
 Symfony\Component\Console\Application->find() at phar://C:/drupalconsole/drupal/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at phar://C:/drupalconsole/drupal/src/Console/Application.php:146
 Drupal\AppConsole\Console\Application->doRun() at phar://C:/drupalconsole/drupal/vendor/symfony/console/Application.php:126
 Symfony\Component\Console\Application->run() at phar://C:/drupalconsole/drupal/bin/console.php:77
 require() at phar://C:/drupalconsole/drupal/bin/console:3
 require() at C:\drupalconsole\drupal:10
@jmolivas
Member
jmolivas commented Sep 4, 2015

@laranatasha: Based on the error message you shared:

In order to list all of the available commands, you should run this inside a drupal root directory.

May you try install drupal and let us know if the issue still happening

You can install drupal with drush using:

$ drush si standard --db-url=mysql://root:root@127.0.0.1/drupal --site-name=drupal8.dev --account-name=admin --account-pass=admin --account-mail=jesus.olivas@blinkreaction.com -y

Make sure you use your own user and database credentials when running drush si and never user root on production. In this example we are accepting any interaction - answering yes when passing -y argument.

Since dev is no stable enough and sometimes introduce errors. We only support beta releases, current latest beta we support is 14 a new release will be tagged next week to support 15

Do you mind to share a screen-shot of how it looks on windows, none of the maintainers use windows.

Feel free to reply here or ask any questions at the support channel:
https://gitter.im/hechoendrupal/DrupalConsole

@laradevitt

@jmolivas: Thanks! But, as I said, I was inside Drupal root. This weekend I will try rolling back to beta14 and see if that changes anything. Also still haven't yet updated drush to an 8.x-friendly version, so I'll do that, too. I'm REALLY excited about using this tool.

Do you mind to share a screen-shot of how it looks on windows, none of the maintainers use windows.

For sure! As soon as I can get things working. :) Cheers -

@jmolivas
Member
jmolivas commented Sep 5, 2015

I tried beta15 and it works fine this is the output of site:status command

System Info
 Drupal                       8.0.0-beta15
 Access to update.php         Protected
 Configuration files          Protected
 Cron maintenance tasks       Last run 1 minute 21 seconds ago
 Database system              MySQL, MariaDB, Percona Server, or equivalent
 Database system version      5.5.42
 Database updates             Up to date
 Drupal core update status    <a href="/admin/reports/updates">Up to date</a>
 Experimental modules enabled Experimental modules found: <em class="placeholder">Migrate, Migrate Drupal</em>. Experimental modules are provided for testing purposes only. Use at your own risk.
 File system                  Writable (<em>public</em> download method)
 GD library                   bundled (2.1.0 compatible)
 GD library PNG support       bundled (2.1.0 compatible)
 Image toolkit                gd
 Node Access Permissions      Disabled
 PHP                          5.5.27 (<a href="/admin/reports/status/php">more information</a>)
 PHP extensions               Enabled
 PHP memory limit             1024M
 Search index progress        100% (0 remaining)
 Trusted Host Settings        Not enabled
 Twig C extension             Not available
 Unicode library              PHP Mbstring Extension
 Update notifications         Enabled
 Upload progress              Not enabled
 Web server
 Hash salt                    Pdgdrm3ZB4e-O5jDs-kEgrP5Ri5WEmJUvZdbL7XCmshLSb2Z24ZDDrux7mLWX4PeoUSeMh-Y3Q
 Console version              0.8.3
 Database connection
 Driver                       mysql
 Host                         127.0.0.1
 Database connection          drupal
 Port
 Username                     root
 Password                     root
 Connection                   mysql//root:root@127.0.0.1/drupal
 Themes
 theme_default                bartik
 theme_admin                  seven
 Directories
 Site root directory          /Users/jmolivas/develop/drupal/sites/drupal8.dev
 Site temporary directory     /tmp
 Default theme directory      /core/themes/bartik
 Admin theme directory        /core/themes/seven
 Configuration
 Active config path           sites/default/files/config_qrLIAbA8-V7Sv33FLrOKnMLENT15Tvo2eLkR6XrQ02DRpmQVStn7CB79-vddC9-cQZVzPgNq5w/active
 Staging config path          sites/default/files/config_qrLIAbA8-V7Sv33FLrOKnMLENT15Tvo2eLkR6XrQ02DRpmQVStn7CB79-vddC9-cQZVzPgNq5w/staging

 The command was executed successfully!

@jmolivas
Member
jmolivas commented Sep 5, 2015

Sorry I re-read the error

In order to list all of the available commands, you should run this inside a drupal root directory.

Seems like for some reason is not founding a site on the root directory.

@laradevitt

Thanks for being so responsive and helpful. :)

My Drupal -dev installation is hardly newer than beta15 (released 3AM yesterday). I used git to set up the repo. I'm not exactly a newbie with these sorts of things, but I must be missing something obvious. I started out in a multisite installation, but saw that there were issues with that so set up a whole new repo, fresh installation of Drupal 8.x, and cd'd into the web root of the new installation. Same errors. Is there something I'm doing wrong?

Anyway, as I said, this weekend I will roll back and also update drush (are there dependencies there? I assumed not.) and report back. Hopefully with good news!

@jmolivas
Member
jmolivas commented Sep 5, 2015

You can download drupal beta 15 using DrupalConsole site:new command

drupal site:new d8beta15.dev

drupal-console-site-new

Once you have latest version of drush you may want to use dl command to download Beta15

drush dl drupal-8.0.0-beta15 --drupal-project-rename=d8beta15.dev

NOTE: d8beta15.devcan be anything you want to, is just the name of the directory where selected version of Drupal will be downloaded.

@laradevitt

@jmolivas - I'm happy to report that I am now able to access all commands from the root of a Drupal 8.0.0-beta14 installation. It still doesn't work for beta15. Let me know if you want me to do anything special to troubleshoot the problem since it sounds like it's working fine for you. In the meantime I will keep fussing with it and report back if I discover anything interesting.

Thanks!

@laradevitt

Oops, my bad. Today I've been having issues with drush after upgrading to 8.0-dev and the beta15 installation didn't take. That's why I wasn't getting the commands in that directory. So now confirmed I have access to the commands in both installations (Drupal 8.0.0-beta14 and beta15). Not sure what could have caused the issue yesterday since that was definitely a fully installed set-up (I had been working on it all day). Cheers -

@jmolivas
Member
jmolivas commented Sep 6, 2015

Yay glad to read that DrupalConsole is currently working with Beta14 and 15 on windows.

@jmolivas
Member

@laradevitt you maybe want to help us testing the project in windows ? ping me if interested

@laradevitt

@jmolivas I'd be happy to. Just let me know what you need.

@jastraat

I'm having this same issue with the latest release of DrupalConsole + RC2. The generate commands are not present.

$ drush8 status

Drupal version                  :  8.0.0-rc2
Site URI                            :  http://dev
Database driver                :  mysql
Database hostname         :  localhost
Database port                   :  3306
Drupal bootstrap               :  Successful

$ drupal list
Drupal Console version 0.9.5

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
    --root[=ROOT]       Define the Drupal root to be use in command execution
  -s, --shell             Launch the shell.
  -e, --env[=ENV]         The Environment name. [default: "prod"]
    --no-debug          Switches off debug mode.
    --learning          Generate a verbose code output.
  -t, --target[=TARGET]   application.console.arguments.target
  -v|vv|vvv, --verbose    Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
  -gc, --generate-chain   Print execution options and arguments as yaml output to be used in chain command
  -gi, --generate-inline  Print execution options and arguments as inline call to be use in the future
  -gd, --generate-doc     application.console.arguments.generate-doc

Available commands:
  _completion        BASH completion hook.
  about              Display basic information about Drupal Console project
  complete           commands.complete.description
  drush              Run drush from console.
  help               Displays help for a command
  init               Copy configuration files to user home directory.
  list               Lists commands
  self-update        Update the console to latest version.
  module
    module:download    Install module or modules in the application
  site
    site:debug         List all known local and remote sites.
    site:install       Install a Drupal project
    site:new           Create a new Drupal project
  theme
    theme:download     Install theme or themes in the application
  yaml
    yaml:diff          Compare two YAML files do determined differences between them
    yaml:merge         Merge one or more YAML files in a new YAML file. Latest values are preserved.
    yaml:split         Split a YAML file using indent as separator criteria
    yaml:update:key    Replace a YAML key in a YAML file.
    yaml:update:value  Update a value for a specific key in a YAML file.

I have drush 7 set as my global default locally with drush 8 aliased to drush8. Is there a dependency on drush?

@jmolivas
Member

@jastraat: you must install drupal 8 to see the full list of available commands, you can use drupal site:install to install drupal 8.

If you run drupal without any command, you will see the message:

In order to list all of the available commands you should install drupal first.

I will send a PRT to show the same message when executing the list command.

@jastraat

@jmolivas I have drupal 8 installed; I'm running RC2. Is Drupal Console only compatible with drupal installations that were installed using Drupal Console?

@jmolivas
Member

@jastraat: DrupalConsole supports any Drupal 8 site, installed via DC, drush or GUI.

Do you mind to share the output of executing drupal ?

@jastraat

Not at all!

$ drupal
The Drupal Console is a suite of tools that you run on the CLI to:
  Learn Drupal 8.
  Generate boilerplate code.
  Interact with a Drupal 8 installation.

Drupal Console version 0.9.5

Drupal supported version Drupal 8 RC-1

Project landing page http://drupalconsole.com
Project change log at http://bit.ly/console-releases
Drupal Console documentation at http://bit.ly/console-book
Support at Drupal Console gitter chat room http://bit.ly/console-support

Supporting organizations
  Indava (http://www.indava.com/)
  Anexus (https://anexusit.com)
  FFW (https://ffwagency.com)

Execute list command to get a list of all commands available.

In order to list all of the available commands you should install drupal first.

However, I do have drupal 8 running. I'm working in a multi-site installation running D8 version RC2. I tried executing the drupal list command at both the drupal root and within an individual site directory. I included part of my drush command showing that my D8 site is bootstrapping without a problem in my original comment.

I'm trying to figure out if DrupalConsole is only compatible with RC1 (which is what is listed from the above output) and NOT RC2. Or if the issue is that I have a multi-site install with nothing in /sites/default or that I'm running drush 8 as an alias 'drush8' or if DrupalConsole is only compatible with DrupalConsole-installed sites.

@jmolivas
Member

@jastraat: Multi-site installation that is the issue, we still have no support for this but is a priority, do you have this site on a repo I can clone to play around.

@laradevitt

Are we on 0.9.3 already? :) For what it's worth, Drupal Console 0.8.3 is still working nicely for me on 8.0.0 HEAD (downloaded today).

@jmolivas
Member

@laradevitt: We are at v0.9.5 now

@jastraat

@jmolivas Thank you for clarifying; extremely good to know that it's a multi-site issue. There isn't much to the D8 site I have installed, so I don't think it would be worth downloading. I just wanted to have at least two sites to try out the new configuration management import/export functionality, so for the sake of testing, I set up a 'dev' site and a 'test' site within the same installation.

@jmolivas
Member

@jastraat : You can work with multiple sites on your local system or at a remote server machine by using:

The --root option (only for local sites)

$ drupal --root=/var/www/drupal8.dev list
$ drupal --root=/var/www/drupal8.test cache:rebuild all

drupal-root

Site alias support (for local and/or remote sites)

$ drupal site:debug
$ drupal site:debug sample.dev
$ drupal --target=sample.dev cache:rebuild all

site-remote

NOTE: In order to have a sample site alias files on your local system, you must execute drupal init to copy those files to your home directory.

@jastraat

Unfortunately, using the 'root' option did not make the generate command available to my multi-site sites. If it's anything like drush, once I'm in a drupal installation directory, root is assumed to be that directory. In drush, you might use the --uri= option to specify the site within an installation. Is there something similar in Drupal Console?

I tried the drupal init command, but I'm afraid I don't understand what it produced or how that could help.

@jmolivas
Member

No multi-site is not yet supported. I meaning you can use --root or --target to work with sites on different directories but must be regular sites no multi-sites.

@jastraat

Ah - thank you. I misunderstood your comment then.

@jmolivas
Member

@laradevitt:

  • Can you please confirm v0.9.5 is functional on WinOS?
  • Do you have a VPN or remote server you can connect from your WinOS to test the remote site command execution?
@laradevitt

@jmolivas

Sure, as soon as I have a moment. I'll have to set up remote; I'm still "just playing" with D8 so all of my remote sites are D7.

@darol100
Contributor

This issue have been gone "off-topic" as well and the current reason of why this issue was open does not apply any more.

For any further conversation feel free to start a conversation at - https://gitter.im/hechoendrupal/DrupalConsole

@darol100 darol100 closed this Jan 16, 2016
@nonsie
nonsie commented Jan 25, 2016

I have two D8 installs - 8.0.1 and 8.0.2. Drupal console is 0.10.5. drupal list shows all possible commands for 8.0.1 but only limited set without generate for 8.0.2 (both run from site root on OS X)

@jmolivas
Member

@nonsie: Is 8.0.2

  • Installed.
  • Multisite.
@nonsie
nonsie commented Jan 27, 2016

Turns out that I was not in the root of the site for 8.0.1. Once I realized that Drupal console worked as it should.

@jmolivas
Member

@nonsie: Glad to read that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment