4

I am running my Drupal 8 project under Acquia Dev Desktop 2 and just got Composer installed. How can I add the Drupal Console to my project?

3 Answers 3

9

You should follow the docs on the official Drupal Console repo on how to install it with Composer. Note that the global launcher is not recommended, it is recommended to add it to your project through Composer.

https://github.com/hechoendrupal/drupal-console/blob/master/README.md

# Change directory to Drupal site
cd /path/to/drupal8.dev

# Download DrupalConsole
composer require drupal/console:~1.0 \
  --prefer-dist \
  --optimize-autoloader \
  --sort-packages

Note that the second command is all one command, not four. The \ tells terminal the command is continuing to the next line.

4
  • > cd /path/to/drupal8.dev "No such file or directory" ? Composer require runs, but I can't get all commands: "In order to list all of the available commands, you should run this against a drupal root directory. " Mar 12, 2017 at 18:52
  • 1
    It's wherever your project lives. That path is just an example.
    – Kevin
    Mar 12, 2017 at 18:53
  • 1
    just curious is Drupal Console always a dev, aka 'require-dev', dependency or just a regular 'require' dependency? Jan 5, 2018 at 23:26
  • @armyofda12mnkeys I add it as require-dev as I don't want to use it on production.
    – apaderno
    Nov 15, 2019 at 16:05
0

In your drupal root folder just run composer require drupal/console, and after that add path_to_your_drupal_installtion\vendor\bin to your system PATH environment variables, and restart your cli. (Windows )...

0

you can install drupal console using composer

open the command line on windows then go to :

cd /path/to/drupal8.dev

now you can install drupal console :

composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader

after that you installed drupal console you can use it from drupal root directory where composer.json exist as follow:

vendor/bin/drupal <the_command>

you should replace <the_command> with one of the drupal console commands. you can see complete list of the commands here: drupal console commands

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.