1

I am having trouble completing a local install of Drupal 8 on my Linux laptop.

I am following this Guide/Blog

I am running Xubuntu Linux 16.04.3 LTS

Composer is installed:

$ which composer
/usr/local/bin/composer

And its version is:

$ composer --version
Composer version 1.6.3 2018-01-31 16:28:17

Drush is also installed:

$ which drush
/usr/bin/drush

And this seems odd to me, but here is its version:

$ drush --version
drush version 5.10.0

Also, they are both in my PATH

echo $PATH
/usr/local/bin/composer:/usr/bin/drush:etc.....

All of this stems from trying to install Drupal 8 locally for a learning/dev environment.

In the folder where my project is located

/var/www/html/drupal8-blog.localhost$ drush --version
drush version 5.10.0

/var/www/html/drupal8-blog.localhost$ composer --version
Composer version 1.6.3 2018-01-31 16:28:17

When trying to install the Drupal site and running this command from the project folder, /var/www/html/drupal8-blog.localhost/web directory, I am getting this error:

:/var/www/html/drupal8-blog.localhost/web$ drush site-install --db-url=mysql://root:<password_not_shown_for_security>@localhost/drupal8_blog
PHP Fatal error:  Class 'Drupal\Core\Session\AccountInterface' not found in /var/www/html/drupal8-blog.localhost/web/core/includes/bootstrap.inc on line 65
Drush command terminated abnormally due to an unrecoverable error.                                                                     [error]
Error: Class 'Drupal\Core\Session\AccountInterface' not found in /var/www/html/drupal8-blog.localhost/web/core/includes/bootstrap.inc,
line 65

I started searching around and have found different places that say Drush must be a higher version to install Drupal 8. In the root folders' composer.json require section, I have

"require": {
        "composer/installers": "^1.2",
        "cweagans/composer-patches": "^1.6",
        "drupal-composer/drupal-scaffold": "^2.2",
        "drupal/console": "^1.0.2",
        "drupal/core": "~8.4",
        "drush/drush": "9.*",
        "webflo/drupal-finder": "^1.0.0",
        "webmozart/path-util": "^2.3"
    },

So I try,

composer update
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Updating zendframework/zend-diactoros (1.7.0 => 1.7.1): Downloading (100%)         
Writing lock file
Generating autoload files
> DrupalProject\composer\ScriptHandler::createRequiredFiles

to update drush, which is verson 9.* in the composer.json file require section, but then checking its verison again,

/var/www/html/drupal8-blog.localhost$ drush --version
drush version 5.10.0

It's still at that same version. So I try to whitelist it:

$ composer update drush/drush
> 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

I don't get it. Can someone point me in the right direction with this? Not sure what is going on. I would like to get the drush and or composer issue sorted out and get the site installed. Any help would be greatly appreciated.

Update: So I tried

$ composer global require drush/drush 9.*
Changed current directory to /my/user/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Updating drush/drush (9.1.0 => 9.2.0): Downloading (100%)         
Writing lock file
Generating autoload files
$ drush --version
drush version 5.10.0

But still it holds same verison.

More updates:

So I did remove the apt version of drush and got the newest version installed with composer. Also added /composer/vendor/bin to my path as suggested. But alas, after the install goes through, when I navigate to my localhost I am seeing this

<?php

/**
 * @file
 * The PHP page that serves all page requests on a Drupal installation.
 *
 * All Drupal code is released under the GNU General Public License.
 * See COPYRIGHT.txt and LICENSE.txt files in the "core" directory.
 */

use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;

$autoloader = require_once 'autoload.php';

$kernel = new DrupalKernel('prod', $autoloader);

$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();

$kernel->terminate($request, $response);

So a little bit of progress but still some issues.

  • Drush launcher might well help. It looks like your current global drush is from the apt repo (which hasn't been maintained in years), so you either need a more recent global version, which you can install with composer global require and making sure ~/.composer/vendor/bin is in your PATH, or something to switch per-project, which the launcher does. Either way probably best to remove the version installed by apt to avoid conflicts – Clive Feb 26 '18 at 20:01
  • @Clive .Thanks for the suggestion. I will give that a shot and see how it goes. – J2112O Feb 26 '18 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.