Open matoeilD opened 7 years ago
@matoeilD 0.11.3 is a really old DrupalConsole version try updating it per site https://docs.drupalconsole.com/en/getting/composer.html and the Launcher https://docs.drupalconsole.com/en/getting/launcher.html
Starting on RC releases DrupalConsole must be installed per site. Install Drupal Console using
composer global require
is no longer supported.
cheers, we will try this out and get back to you. Is there a proper uninstall procedure? The composer global update seems to have mess things up.
@matoeilD The composer global require
and composer global update
are no longer supported.
Since using composer you can try per-site composer remove
or global installation composer global remove
Right, the drupal self-update output message was misleading because the version was way too old.
Thanks again for that , we will try that out.
@matoeilD Is this still an issue?
Hello, i have the same problem.
My drupal root resides within docroot/
subfolder.
Installed drupal console using this command:
composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader
Then tried to issue drupal
from the same folder where i issued previous command that gave me this error:
-bash: /usr/local/composer/vendor/bin/drupal: No such file or directory
So i did a symlink. But that didn't help. Recieved error:
PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager".
composer show | grep console
outputs following:
drupal/console 1.3.2 The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal. drupal/console-core 1.3.2 Drupal Console Core drupal/console-dotenv 0.3.0 Drupal Console Dotenv drupal/console-en 1.3.2 Drupal Console English Language drupal/console-extend-plugin 0.9.2 Drupal Console Extend Plugin
Installed Console launcher following these steps.
Tried to launch drupal
command again, which produced next error:
Something is wrong with your drupal.phar archive. Try downloading again by executing from your terminal: curl https://drupalconsole.com/installer -L -o drupal.phar
So i did this too.
Trying to launch this command once more. Error:
PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager". in phar:///usr/local/composer/vendor/bin/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php:1018 Stack trace:
0 phar:///usr/local/composer/vendor/bin/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php(585): Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition('console.configu...')
1 phar:///usr/local/composer/vendor/bin/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php(563): Symfony\Component\DependencyInjection\ContainerBuilder->doGet('console.configu...', 1)
2 phar:///usr/local/composer/vendor/bin/drupal/vendor/drupal/console-core/src/Bootstrap/DrupalConsoleCore.php(64): Symfony\Component\DependencyInjection\ContainerBuilder->get('console.configu...')
3 phar:///usr/local/composer/vendor/bin/drupal/bin/drupal.php(40): Drupal\Console\Core\Bootstrap\DrupalConsoleCore->boot()
4 phar:///usr/local in phar:///usr/local/composer/vendor/bin/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php on line 1018
If I specify path to drupal root: drupal --root=/var/www/drupal/docroot
, then i have next errors:
[ERROR] Drupal Console is not installed at: /var/www/drupal/docroot You must execute the following composer commands: composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader
The latter problem was caused by empty composer.json in the docroot/
folder. Removed that, tried to specify the path to root, but the error is the same:
PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager". in phar:///usr/local/composer/vendor/bin/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php:1018
Okay, i've managed to make it work by executing next few commands:
composer global remove drupal/console-launcher
/var/www/drupal/packages/drupal/console/bin/drupal --root=/var/www/intarsia_platform/docroot
So what am i missing? Why is this the only way to launch drupal console?
When i execute drupal
i get only:
-bash: /usr/local/composer/vendor/bin/drupal: No such file or directory
What can i do to simplify it to only drupal
instead of this whole line?
Much appreciated for help
How to fix...
From the root level of a site (where composer.json lives) $ drupal -V returns~ [ERROR] Class Drupal\Core\DrupalKernel does not exist. Drupal Console version 1.8.0
$ vendor\drupal\console\bin\drupal -V returns~ Drupal Console version 1.8.0
Obviously in the first case it was running the global console.
If you use composer to build and manage your site then most likely you already have it fixed... Look closely and consider the following commands to install a module at the site level (where composer.json lives)...
composer require drupal/moduleName bin\drupal module:install moduleName
This is running the console from siteName/bin to install the module.
So from that level... $ bin\drupal -V returns~ Drupal Console version 1.8.0 $ cd web $ ..\bin\drupal -V returns~ Drupal Console version 1.8.0 and so on.
~If that did not work then Another fix~ Define a user environment variable (could have also been a system env var) called DrupCon or whatever with the value: vendor\drupal\console\bin\drupal
Note:: Look at drupal.bat in siteName/bin it's just about doing this exact same process.
Now from a site root level:
$ %drupcon% -V returns~ Drupal Console version 1.8.0
$ cd web
$ ..\%drupcon% -V returns~ Drupal Console version 1.8.0
and so on.
*The slash in " .. \ %drupcon%" -V above is not showing in this editor.
With this relative path variable method allows to be able to jump into any site and reduce some typing to access that sites Drupal console just like bin\drupal should.
If your are seeing "[ERROR] Class Drupal\Core\DrupalKernel does not exist." but are able to run commands then likely you have both global and site Drupal consoles installed like I do, but you are running the global console from within your site when you are expecting the local one.
@jch-Github Starting on RC releases DrupalConsole must be installed per site. Install Drupal Console using composer global require
is no longer supported.
More info at the docs page: https://docs.drupalconsole.com/en/getting/project.html
Jesus,
I tired adding the launcher to an existing Drupal 8.5.3 core with drupalcommerce/project-base 2.7 built and maintained entirely with composer.
I placed the drupal.phar in a sites/bin directory that is at the beginning of my environment path so I am sure it finds it first before anything else.
from the sites directory ~ the command: drupal returns~ [ERROR] DrupalConsole must be executed within a Drupal Site. Which is what should be expected, so this is good.
The sites directory is the root of many drupal sites. When I go into any site i.e. sites/someSite ... This is a site root where composer.json and the web directory lives.
The command: drupal returns~ [ERROR] Class Drupal\Core\DrupalKernel does not exist. ... This tells me the global drupal console is running and even though drupal.phar was found first, it did not do squat.
The command: bin\drupal runs the local (in the site) drupal console just as before adding the drupal.phar (launcher).
The inclusion of "drupal self-update" in the referenced docs indicates the information may be very dated and suspect.
I have tried placing drupal.phar in the site at the top level with no effect.
After doing a composer global remove drupal/console The command: drupal returns~ ' drupal' is not recognized as an internal or external command, operable program or batch file.
The only way to start the console is by using a relative path to bin\drupal as before installing the phar launcher.
.
On Tue, Jun 5, 2018 at 1:11 AM, Jesus Manuel Olivas < notifications@github.com> wrote:
@jch-Github https://github.com/jch-Github Starting on RC releases DrupalConsole must be installed per site. Install Drupal Console using composer global require is no longer supported.
More info at the docs page: https://docs.drupalconsole. com/en/getting/project.html
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hechoendrupal/drupal-console/issues/3533#issuecomment-394593252, or mute the thread https://github.com/notifications/unsubscribe-auth/AesVSt187hw3hs0TrrDghwkBHd_tfFkiks5t5iEWgaJpZM4Pi18q .
Jesus,
I believe the reason that drupal console does not work for Drupal 8 project-bases other than a generic
composer create-project \ drupal-composer/drupal-project:8.x-dev
is due to the placement of the bin directory in the build.
For a commerce2.x build the bin directory is in the top level NOT within vendor. All Drupal 8 structures are NOT built the same.
In composer.json my d8 commerce sites have... "config": { "bin-dir": "bin", "sort-packages": true },
I tried placing a copy of the bin directory and the launcher still does not work.
I've spent too much time messing around with the launcher which has the ability to provide little benefit when I can launch console simply with bin\drupal from the site root or by appending a relative path from anywhere else.
I'm not going to alter my .json file just to test further as I am in the middle of doing other things with this sand box at this time.
For anyone that has not done a lot of various Drupal 8 project-base builds, I believe the launcher most likely will introduce confusion once they do a build that launcher can not handle.
Jim.
On Tue, Jun 5, 2018 at 7:57 PM, James Harrison < james.harrison.email@gmail.com> wrote:
Jesus,
I tired adding the launcher to an existing Drupal 8.5.3 core with drupalcommerce/project-base 2.7 built and maintained entirely with composer.
I placed the drupal.phar in a sites/bin directory that is at the beginning of my environment path so I am sure it finds it first before anything else.
from the sites directory ~ the command: drupal returns~ [ERROR] DrupalConsole must be executed within a Drupal Site. Which is what should be expected, so this is good.
The sites directory is the root of many drupal sites. When I go into any site i.e. sites/someSite ... This is a site root where composer.json and the web directory lives.
The command: drupal returns~ [ERROR] Class Drupal\Core\DrupalKernel does not exist. ... This tells me the global drupal console is running and even though drupal.phar was found first, it did not do squat.
The command: bin\drupal runs the local (in the site) drupal console just as before adding the drupal.phar (launcher).
The inclusion of "drupal self-update" in the referenced docs indicates the information may be very dated and suspect.
I have tried placing drupal.phar in the site at the top level with no effect.
After doing a composer global remove drupal/console The command: drupal returns~ ' drupal' is not recognized as an internal or external command, operable program or batch file.
The only way to start the console is by using a relative path to bin\drupal as before installing the phar launcher.
.
On Tue, Jun 5, 2018 at 1:11 AM, Jesus Manuel Olivas < notifications@github.com> wrote:
@jch-Github https://github.com/jch-Github Starting on RC releases DrupalConsole must be installed per site. Install Drupal Console using composer global require is no longer supported.
More info at the docs page: https://docs.drupalconsole.com /en/getting/project.html
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hechoendrupal/drupal-console/issues/3533#issuecomment-394593252, or mute the thread https://github.com/notifications/unsubscribe-auth/AesVSt187hw3hs0TrrDghwkBHd_tfFkiks5t5iEWgaJpZM4Pi18q .
Duplicate of #3283 ?
Having the same issue plus getting "[ERROR] Command "generate:module", is not a valid command name."
I fixed this by replacing:
require 'drupal.php';
with
require '[full path to drupal root (not web)]/vendor/drupal/console/bin/drupal.php';
in the drupal console executible.
I also create a drupal console on a per site basis named like [site name]-drupal in /usr/bin and point each to the appropriate drupal.php
It also works to use a relative path in the require if you want a single drupal console that can be run in any site:
require 'vendor/drupal/console/bin/drupal.php';
You just need to make sure you are in the site's drupal root, outside of web, when running it, and be sure all of your sites have the same version of core, when running it this way.
It eliminated the Drupal/Kernel errors both ways.
So far every command that's listed below functions correctly, including generate module.
This now results (when run with no arguments) in: `Drupal Console version 1.8.0
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 -e, --env[=ENV] The Environment name [default: "prod"] --root[=ROOT] Define the Drupal root to be used in command execution --debug Switches on debug mode --learning Generate a verbose code output -c, --generate-chain Shows command options and arguments as yaml output to be used in chain command -i, --generate-inline Shows command options and arguments as inline command -d, --generate-doc Shows command options and arguments as markdown -t, --target[=TARGET] Site name you want to interact with (for local or remote sites) -l, --uri=URI URI of the Drupal site to use (for multi-site environments or when running on an alternate port) -y, --yes Skip confirmation and proceed -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands: about Displays basic information about Drupal Console project chain Chain command execution check System requirement checker composerize Converts Drupal codebase to composer. exec Execute an external command. help Displays help for a command init Copy configuration files. list Lists all available commands server (serve,rs) Runs PHP built-in web server shell Open a shell providing an interactive REPL (Read–Eval–Print-Loop). cache cache:rebuild (cr,cc) Rebuild and clear all site caches. cache:tag:invalidate (cti) Invalidate cache tags. ckeditor_media_embed ckeditor_media_embed:install Install library dependencies for the CKEditor Media Embed plugin. ckeditor_media_embed:update Update library dependencies for the CKEditor Media Embed plugin. commerce commerce:create:store Create a new store. config config:delete (cd) Delete configuration config:diff (cdi) Output configuration items that are different in active configuration compared with a directory. config:edit (ced,cdit) Change a configuration object with a text editor. config:export (ce) Export current application configuration. config:export:content:type (cect) Export a specific content type and their fields. config:export:single (ces) Export a single configuration or a list of configurations as yml file(s). config:export:view (cev) Export a view in YAML format inside a provided module to reuse in other website. config:import (ci) Import configuration to current application. config:import:single (cis) Import a single configuration or a list of configurations. config:override (co) Override config value in active configuration. config:validate (cv) Validate a drupal config against its schema create create:comments (crc) Create dummy comments for your Drupal 8 application. create:nodes (crn) Create dummy nodes for your Drupal 8 application. create:roles (crr) Create dummy roles for your Drupal 8 application. create:terms (crt) Create dummy terms for your Drupal 8 application. create:users (cru) Create dummy users for your Drupal 8 application. create:vocabularies (crv) Create dummy vocabularies for your Drupal 8 application. cron cron:execute (croe,cre) Execute cron implementations by module or execute all crons cron:release (cror) Release cron system lock to run cron again database database:add (dba) Add a database to settings.php database:client (dbc) Launch a DB client if it's available database:connect (dbco,sqlc) Shows DB connection database:drop (dbd) Drop all tables in a given database. database:dump (dbdu) Dump structure and contents of a database database:log:clear (dblc) Remove events from DBLog table, filters are available database:log:poll (dblp) Poll the watchdog and print new log entries every x seconds database:query (dbq,sqlq) Executes a SQL statement directly as argument database:restore (dbr) Restore structure and contents of a database. debug debug:breakpoints (dbre) Displays breakpoints available in application debug:cache:context (dcc) Displays current cache context for the application. debug:chain (dch) List available chain files. debug:config (dc) List configuration objects names and single configuration object. debug:config:settings (dcs) Displays current key:value on settings file. debug:config:validate (dcv) Validate a schema implementation before a module is installed. debug:container (dco,cod) Displays current services for an application. debug:cron (dcr) List of modules implementing a cron debug:database:log (dbb,ws) Displays current log events for the application debug:database:table (ddt) Show all tables in a given database. debug:dotenv Debug Dotenv debug values. debug:entity (de) Debug entities available in the system debug:event (dev) Displays current events debug:image:styles (dis) List image styles on the site debug:libraries (dl) Displays libraries available in application debug:migrate (mid) Display current migration available for the application debug:module (dm) Displays current modules available for application debug:multisite (dmu,msd) List all multi-sites available in system debug:permission (dp) Displays all user permissions. debug:plugin (dpl) Displays all plugin types. debug:queue (dq) Displays the queues of your application debug:rest (rede) Display current rest resource for the application debug:roles (dusr) Displays current roles for the application debug:router (dr,rod) Displays current routes for the application or information for a particular route debug:settings (dse) List user Drupal Console settings. debug:site (dsi) List all known local and remote sites. debug:state (dst) Show the current State keys. debug:theme (dt,tde) Displays current themes for the application debug:theme:keys (dtk) Displays all theme keys provided by hook_theme functions debug:update (du,upd) Displays current updates available for the application debug:user (dus) Displays current users for the application debug:views (vde) Displays current views resources for the application debug:views:plugins (dvp) Displays current views plugins for the application devel devel:dumper (dd) commands.devel.dumper.messages.change-devel-dumper-plugin develop develop:contribute Download Drupal + Drupal Console to contribute. docker docker:init Create a docker-compose.yml file dotenv dotenv:init Add support and required config to work with an .env file entity entity:delete (ed) Delete an specific entity field field:info (fii) View information about fields. generate generate:ajax:command (gac) Generate & Register a custom ajax command generate:authentication:provider (gap) Generate an Authentication Provider generate:breakpoint (gb) Generate breakpoint generate:cache:context (gcc) Generate a cache context generate:command (gco) Generate commands for the console. generate:controller (gcon) Generate & Register a controller generate:entity:bundle (geb) Generate a new content type (node / entity bundle) generate:entity:config (gec) Generate a new config entity generate:entity:content (geco) Generate a new content entity generate:event:subscriber (ges) Generate an event subscriber generate:form (gf) Generate a new "FormBase" generate:form:alter (gfa) Generate an implementation of hook_form_alter() or hook_form_FORM_ID_alter generate:form:config (gfc) Generate a new "ConfigFormBase" generate:help (gh) Generate an implementation of hook_help() generate:jstest (gjt) Generate a JavaScript test. generate:module (gm) Generate a module. generate:module:file (gmf) Generate a .module file generate:permissions (gp) Generate module permissions generate:plugin:block (gpb) Generate a plugin block generate:plugin:ckeditorbutton (gpc) Generate CKEditor button plugin. generate:plugin:condition (gpco) Generate a plugin condition. generate:plugin:field (gpf) Generate field type, widget and formatter plugins. generate:plugin:fieldformatter (gpff) Generate field formatter plugin. generate:plugin:fieldtype (gpft) Generate field type plugin. generate:plugin:fieldwidget (gpfw) Generate field widget plugin. generate:plugin:imageeffect (gpie) Generate image effect plugin. generate:plugin:imageformatter (gpif) Generate image formatter plugin. generate:plugin:mail (gpm) Generate a plugin mail generate:plugin:metatag:group commands.generate.metatag.group.description generate:plugin:metatag:tag commands.generate.metatag.tag.description generate:plugin:migrate:process (gpmp) Generate a migrate process plugin generate:plugin:migrate:source (gpms) Generate a migrate source plugin generate:plugin:rest:resource (gprr) Generate plugin rest resource generate:plugin:rulesaction (gpra) commands.generate.plugin.rulesaction.description generate:plugin:skeleton (gps) Generate an implementation of a skeleton plugin generate:plugin:type:annotation (gpta) Generate a plugin type with annotation discovery generate:plugin:type:yaml (gpty) Generate a plugin type with Yaml discovery generate:plugin:views:field (gpvf) Generate a custom plugin view field. generate:post:update (gpu) Generate an implementation of hook_post_update_NAME() generate:profile (gpr) Generate a profile. generate:routesubscriber (gr) Generate a RouteSubscriber generate:service (gs) Generate service generate:site:alias (gsa) Generates a site alias. generate:theme (gt) Generate a theme. generate:twig:extension (gte) Generate a Twig extension. generate:update (gu) Generate an implementation of hook_update_N() image image:styles:flush (isf) Execute flush function by image style or execute all flush images styles locale locale:language:add Add languages to be supported by your site locale:language:delete Delete a language to be supported by your site locale:translation:status List available translation updates migrate migrate:execute (mie) Execute a migration available for application migrate:rollback (mir) Rollback one or multiple migrations migrate:setup (mis) Load and create the relevant migrations for a provided legacy database module module:dependency:install (modi) Install dependencies module in the application module:download (mod) Download module or modules in application module:install (moi) Install module or modules in the application module:path (mop) Returns the relative path to the module (or absolute path) module:uninstall (mou) Uninstall module or modules in the application module:update (moup) Update core, module or modules in the application multisite multisite:new (mun,sn) Sets up the files for a new multisite install. multisite:update (muu) Update the files for a multisite installed. node node:access:rebuild (nar) Rebuild node access permissions. queue queue:run (qr) Process the selected queue. quick quick:start Download, install and serve a new Drupal project rest rest:disable (red) Disable a rest resource for the application rest:enable (ree) Enable a rest resource for the application role role:delete (rd) Delete roles for the application role:new (rn) Create roles for the application router router:rebuild (rr,ror) Rebuild routes for the application settings settings:set Change a specific setting value in DrupalConsole config file site site:import:local (sil) Import/Configure an existing local Drupal project site:install (si) Install a Drupal project site:maintenance (sma) Switch site into maintenance mode site:mode (smo) Switch system performance configuration site:new Download a new Drupal project site:statistics (sst) Show the current statistics of website. site:status (ss,st) View current Drupal Installation status state state:delete (std) Delete State state:override (sto) Override a State key. taxonomy taxonomy:term:delete (ttd) Delete taxonomy terms from a vocabulary theme theme:download (thd) Download theme in application theme:install (thi) Install theme or themes in the application theme:path (thp) Returns the relative path to the theme (or absolute path) theme:uninstall (thu) Uninstall theme or themes in the application update update:entities (upe) Applying Entity Updates update:execute (upex,updb) Execute a specific Update N function in a module, or execute all user user:create (uc) Create users for the application user:delete (ud) Delete users from the application user:login:clear:attempts (ulca,uslca) Clear failed login attempts for an account. user:login:url (ulu,usli,uli) Returns a one-time user login url. user:password:hash (uph,usph) Generate a hash from a plaintext password. user:password:reset (upr,upsr) Reset password for a specific user. user:role (ur) Adds/removes a role for a given user views views:disable (vd,vdi) Disable a View views:enable (ve) Enable a View ` Per site is much safer because if you have different versions of core in your sites the console won't break in some if they're a different version. It took a a few hours (between many tasks) to figure this out but drupal console is worth it :-)
I am running Drupal 8 in a Docker container. The base directory is mysite and when I did my original install of Drupal 8, it created a vendor directory [mysite/vendor] and put all of the Drupal files in a web directory [mysite/web]. docroot for my site is obviously mysite/web. I have tried to use curl to download the composer installer, but when I do so I only get a 323 byte server error file. I cannot execute composer create-project
because that requires an empty directory and both the mysite/ and the mysite/web/ directories have files in them. After reading a lot of documentation, it seemed to me that I should try composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader
from within the mysite/web directory. This seemed to work, creating a vendor directory in my web/ directory, and I can run drupal console from within the web directory by running vendor/bin/drupal. HOWEVER, I get Class Drupal\Core\DrupalKernel does not exist error and a second error that says "console.site_install - You have requested a non-existent service "extension.list.module". Also, only a few of the commands seem to work. Any suggestions??
@wdseelig did you get any solution for this? I am also facing the same problem in my docker setup.
Issue title
[command:any] [ERROR] Class Drupal\Core\DrupalKernel does not exist. after a composer global update
short description
After a composer global update, any drupal commands generates an error. [ERROR] Class Drupal\Core\DrupalKernel does not exist. PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager". in /var/aegir/.composer/vendor/symfony/dependency-injection/ContainerBuilder.php:994
Problem/Motivation
Trying to update the console from 0.11.3, i am stuck with an error on any drupal console command:
-composer update drupal/console --with-dependencies : had no effect -composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader : had no effect -drupal self-update ==> [ERROR] This instance of the CLI was not installed as a Phar archive. Update using: composer global update -composer global update : generates
[ERROR] Class Drupal\Core\DrupalKernel does not exist. PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "console.configuration_manager". in /var/aegir/.composer/vendor/symfony/dependency-injection/ContainerBuilder.php:994
How can i fix his out ?
Details to include:
Best regards, M.dandonneau