Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

site:install PHP Fatal error: Uncaught Error: Class 'Drupal\Core\Language\LanguageManager' not found in .composer/vendor/drupal/console/src/Helper/DrupalHelper.php:179 #2589

Closed
therobyouknow opened this issue Aug 16, 2016 · 5 comments

Comments

@therobyouknow
Copy link

Followed steps in: https://www.drupal.org/node/2471553 to set up a Drupal 8 up via Composer commands, to set up my site, with doc root: /var/www/d8.dev

But wanted to try using Drupal Console install command instead of drush (specified in the steps) to do the actual site install as the last step.

So I downloaded Console using:

composer global require drupal/console:@stable
as per the Drupal Console doc: https://hechoendrupal.gitbooks.io/drupal-console/content/en/getting/composer.html

(when in my /home/vagrant/ folder)

Then I went to /var/www/d8.dev to run the site install command

drupal site:install minimal --db-name="d8" --db-user="d8" --db-pass="d8" --site-name="D8 Example" --site-mail="email@example.com" --account-name="d8" --account-mail="email@example.com" --account-pass="d8"

When I ran this I got:

PHP Fatal error: Uncaught Error: Class 'Drupal\Core\Language\LanguageManager' not found in /home/vagrant/.composer/vendor/drupal/console/src/Helper/DrupalHelper.php:179
Stack trace:
#0 /home/vagrant/.composer/vendor/drupal/console/src/Command/Site/InstallCommand.php(343): Drupal\Console\Helper\DrupalHelper->getStandardLanguages()
#1 /home/vagrant/.composer/vendor/drupal/console/src/Command/Site/InstallCommand.php(140): Drupal\Console\Command\Site\InstallCommand->getLanguages()
#2 /home/vagrant/.composer/vendor/symfony/console/Command/Command.php(244): Drupal\Console\Command\Site\InstallCommand->interact(Object(Symfony\Component\Console\Input\ArgvInput), Object(Drupal\Console\Style\DrupalStyle))
#3 /home/vagrant/.composer/vendor/symfony/console/Application.php(863): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Drupal\Console\Style\DrupalStyle))
#4 /home/vagrant/.composer/vendor/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(O in /home/vagrant/.composer/vendor/drupal/console/src/Helper/DrupalHelper.php on line 179

Fatal error: Uncaught Error: Class 'Drupal\Core\Language\LanguageManager' not found in /home/vagrant/.composer/vendor/drupal/console/src/Helper/DrupalHelper.php:179
Stack trace:
#0 /home/vagrant/.composer/vendor/drupal/console/src/Command/Site/InstallCommand.php(343): Drupal\Console\Helper\DrupalHelper->getStandardLanguages()
#1 /home/vagrant/.composer/vendor/drupal/console/src/Command/Site/InstallCommand.php(140): Drupal\Console\Command\Site\InstallCommand->getLanguages()
#2 /home/vagrant/.composer/vendor/symfony/console/Command/Command.php(244): Drupal\Console\Command\Site\InstallCommand->interact(Object(Symfony\Component\Console\Input\ArgvInput), Object(Drupal\Console\Style\DrupalStyle))
#3 /home/vagrant/.composer/vendor/symfony/console/Application.php(863): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Drupal\Console\Style\DrupalStyle))
#4 /home/vagrant/.composer/vendor/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(O in /home/vagrant/.composer/vendor/drupal/console/src/Helper/DrupalHelper.php on line 179

Can you advise, please?

  • Should I try to get the missing dependency - please advise
  • Or am I doing something wrong whereby if I did it properly I wouldn't get this error (and therefore not need to get the dependency)
@jmolivas
Copy link
Member

@therobyouknow try installing DrupalConsole per/site, from site root executing

composer require drupal/console:~1.0

Docs must be updated.

@therobyouknow
Copy link
Author

Sorry @jmolivas this did not work for me.

[01:21 PM]-[vagrant@d8]-[/var/www/d8.dev] 
$ cd /var/www/d8.dev/

[01:22 PM]-[vagrant@d8]-[/var/www/d8.dev] 
$ ls
composer.json*  composer.lock*  drush/  LICENSE*  phpunit.xml.dist*  README.md*  scripts/  vendor/  web/

$ composer require drupal/console:~1.0
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)

Nothing to install or update
Generating autoload files
> DrupalProject\composer\ScriptHandler::createRequiredFiles

01:34 PM]-[vagrant@d8]-[/var/www/d8.dev] 
$ pwd
/var/www/d8.dev

[01:34 PM]-[vagrant@d8]-[/var/www/d8.dev] 
$ ls
composer.json*  composer.lock*  drush/  LICENSE*  phpunit.xml.dist*  README.md*  scripts/  vendor/  web/

[01:34 PM]-[vagrant@d8]-[/var/www/d8.dev] 
$ drupal about
drupal: command not found

[01:34 PM]-[vagrant@d8]-[/var/www/d8.dev] 
$ 

Also, before I ran your suggested command, I looked in composer.json and saw that it already had "drupal/console": "~1.0" under require: - so why would I need to issuecomposer require drupal/console:~1.0 if running composer create-project drupal-composer/drupal-project:8.x-dev /var/www/d8.dev --stability dev --no-interaction should download all the dependencies including composer?

Thank you for your help so far, but can you advise on the above?

@therobyouknow
Copy link
Author

Looks like I solved it. Solution to follow very shortly.

@therobyouknow
Copy link
Author

therobyouknow commented Aug 17, 2016

Here's how I got further, my solution so far

When in /var/www/d8.dev, I ran composer require drupal/console:@stable which pulled down the latest stable.

$ composer require drupal/console:@stable
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing drupal/console (1.0.0-beta5)
  - Installing drupal/console (0.11.3)
    Downloading: 100%         

Writing lock file
Generating autoload files
> DrupalProject\composer\ScriptHandler::createRequiredFiles

[02:12 PM]-[vagrant@d8]-[/var/www/d8.dev]

This updated the composer.json file with a later version of console (the latest stable)

Then I remembered from using drush that such tools are stored in the vendor folder, so I did:

./vendor/bin/drupal

But got errors about gd and curl being missing:

[ERROR] The extension gd is missing.

[ERROR] The extension curl is missing.

So I installed php7 versions of these as my puphpet.com vagrant provisioned VM is Ubuntu 14.04 64bit LTS with PHP 7:

sudo apt-get install php7.0-gd
sudo apt-get install php7.0-curl

In my docroot, /var/www/d8.dev I then did:

./vendor/bin/drupal

(based on my recall mentioned earlier that drush had to be run like this)

Then I got the error:

[WARNING] The /home/vagrant/.console/config.yml config file is missing, try executing drupal init

So I ran Drupal init:

./vendor/bin/drupal init

from my docroot

and this worked out fine:

Copied files
 User home path: /home/vagrant/.console/
 1 - aliases.yml
 2 - chain/create-data.yml
 3 - chain/form-sample.yml
 4 - chain/quick-start-mysql.yml
 5 - chain/quick-start.yml
 6 - chain/sample.yml
 7 - chain/site-drop-restore.yml
 8 - chain/site-install.yml
 9 - chain/update-gitbook.yml
 10 - commands.yml
 11 - config.yml
 12 - phpcheck.yml
 13 - router.php
 14 - site.mode.yml
 15 - sites/sample.yml

Bash or Zsh: Add this line to your shell configuration file:
source "$HOME/.console/console.rc" 2>/dev/null

Fish: Create a symbolic link
ln -s ~/.console/drupal.fish ~/.config/fish/completions/drupal.fish


[02:18 PM]-[vagrant@d8]-[/var/www/d8.dev] 
$

$ ./vendor/bin/drupal about

Drupal Console (0.11.3) | Supports Drupal (8.0.x) | Drupal is not installed


Copy configuration files to user home directory.

   drupal init --override

Download, install and serve Drupal 8

   drupal chain --file=~/.console/chain/quick-start.yml

Create a new Drupal project

   drupal site:new drupal8.dev 8.0.x

Install a Drupal project

   drupal site:install

Lists all available commands

   drupal list

Update project to the latest version.


   drupal self-update

So my next step would be to run the drupal site:install to install Drupal instead of using drush

@therobyouknow
Copy link
Author

therobyouknow commented Aug 17, 2016

drupal site:install worked fine as described here: #2592 (comment)

I'll also add that I needed to adjust my puphpet.com generated config.yaml so that Apache is pointed to /web in the docroot:

    vhosts:
        av_wbjiledtsihf:
            servername: d8.dev
            docroot: /var/www/d8.dev/web
            port: '80'
            setenv:
                - 'APP_ENV dev'
            setenvif:
                - 'Authorization "(.*)" HTTP_AUTHORIZATION=$1'
            custom_fragment: ''
            ssl: '0'
            ssl_cert: ''
            ssl_key: ''
            ssl_chain: ''
            ssl_certs_dir: ''
            ssl_protocol: ''
            ssl_cipher: ''
            directories:
                avd_ox64fjgg0zrs:
                    path: /var/www/d8.dev
                    options:
                        - Indexes
                        - FollowSymlinks
                        - MultiViews
                    allow_override:
                        - All
                    require:
                        - 'all granted'
                    custom_fragment: ''
                    files_match:
                        avdfm_j2acfi56atnq:
                            path: \.php$
                            sethandler: 'proxy:fcgi://127.0.0.1:9000'
                            custom_fragment: ''
                            provider: filesmatch
                    provider: directory

Note that it's only the docroot path that needs web added, nothing else. Make sure you do a vagrant provision so that the change is applied to the VM.

This adjustment is to the config.yaml file from my puphpet.com generated manifest .zip file that I generated from puphpet.com today. Main settings I chose were:

  • virtualbox
  • Ubuntu 14.04 LTS 64bit
  • PHP7
  • xdebug enabled
  • MySQL as database
  • drush enabled (8.0.5 - though I'm not using that, at the moment)

I really hope all this helps others. I've been through frustrating times trying to "do the right thing" with setting up Drupal 8 (i.e. using all the state of the art PHP tools like Composer and Console that the in-crowd cognoscenti use for their development) and not the cop out of just downloading the zip and using drush. Triumph!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants