1

Following the amazing work @david-snopek posted:

I spent the better part of last evening trying to get CiviCRM up and running on a Drupal 8.4 BLT project.

After trying a few different approaches, unfortunately I'm now seeing the following error when trying to enable the CiviCRM Core Module

CiviCRM must be downloaded into the libraries folder. enter image description here

No matter what I try, I can't seem to get the module to recognize that civicrm is installed.

Other things I've tried:

  1. manually copying the [project_root]/vendor/civicrm-core into [project_root]/docroot/libraries/civicrm-core
  2. Renaming libraries/civicrm-coreto libraries/civicrm
  3. Modifying composer.json to try and install CiviCRM into the libraries folder:
  4. Creating symbolic links to the folder (my least favorite attempt)

Here is the composer.json update for number 3 above:

    "require": {
    "acquia/blt": "^8.3",
    "phpoffice/PHPWord": "dev-zend-version as 0.13.0",
    "civicrm/civicrm-core": "4.7.25"
},

...

"repositories": {
    "phpword": {
        "type": "vcs",
        "url": "https://github.com/dsnopek/PHPWord.git"
    },
    "zetacomponents-mail": {
        "type": "vcs",
        "url": "https://github.com/civicrm/zetacomponents-mail.git"
    },
    "civicrm": {
        "type": "package",
        "package": {
            "name": "civicrm/civicrm-core",
            "version": "4.7.25",
            "type": "drupal-library",
            "source": {
                "url": "https://github.com/civicrm/civicrm-core.git",
                "type": "git",
                "reference": "origin/master"
           }
        }
    }
}

source: https://gist.github.com/mortenson/a5390d99013b5b8c0254081e89bb4d47

I think this has to do with an autoloader issue perhaps seeing that BLT does not use the drupal composer.json file and the instructions @david-snopek posted were for the traditional Drupal installation method.

I was able to trace the error to modules/custom/civicrm-drupal/civicrm.install:125

/**
 * Returns the path to where CiviCRM is installed.
 *
 * @return string|void
 *
 * Recommended location for civicrm is in /libraries/civicrm [citation needed].
 * We also allow /modules/civicrm, which seems to work fine.
 */
function _civicrm_find_civicrm() {
  if ($path = drupal_get_path('module', 'civicrm')) {
    if (file_exists($path . '/CRM/Core/ClassLoader.php')) {
      return \Drupal::service('file_system')->realpath($path);
    }
  }

  $path = 'vendor/civicrm/civicrm-core';
  if (file_exists($path . '/CRM/Core/ClassLoader.php')) {
    return \Drupal::service('file_system')->realpath($path);
  }

  return NULL;
}

Notes on my process:

I ran into a couple snags with the Gist David posted.

  1. When running $ composer require 'phpoffice/PHPWord:dev-zend-version as 0.13.0', I noticed that composer was trying to add the dependency as:

"require": { "phpoffice/PHPWord": "dev-zend-version", "as 0.13.0" },

This failed but I was able to get past the issue by manually adding the dependency to the composer.json file as:

"require": { "acquia/blt": "^8.3", "phpoffice/PHPWord": "dev-zend-version as 0.13.0", },

Unfortunately, I then got stuck on the next step requiring civicrm-core until I read the comment a bit closer. I believe this step is now incorrect as civicrm-core 4.7.25 has been released.

#Require civicrm-core at the requested version.
#TODO: Need to keep using my fork until 4.7.25 is released!
#composer require civicrm/civicrm-core:$CIVICRM_VERSION
composer require "civicrm/civicrm-core:dev-roundearth-$CIVICRM_VERSION as $CIVICRM_VERSION"

I was able to get past that issue by updating the additional repository via: composer config repositories.civicrm-core vcs https://github.com/civicrm/civicrm-core.git

Reference: https://www.mydropwizard.com/blog/how-install-civicrm-drupal-8-and-why-choose-it-over-pure-drupal-crm

0

Following literally the instructions for manual installation as given by David Snopek (https://www.mydropwizard.com/blog/how-install-civicrm-drupal-8-and-why-choose-it-over-pure-drupal-crm) I succeeded in installing civicrm 4.7.27 under Drupal 8.4.2.

One caveat: I installed Drupal with composer (https://www.drupal.org/docs/develop/using-composer/using-composer-to-manage-drupal-site-dependencies), using option B on that page "drupal/drupal" as using this option put vendor under the document root, something that is necessary according to David's blog post. In the Drupal documentation it is indicated that with option B one must manually add some lines to the composer.json file but, at least with 8.4.2, it is all there. But the error code about the libraries folder may indicate that these lines are not available in your composer.json file.

I cannot provide additional help but at least, the instructions from David seem to work still with the latest versions of both Drupal and Civicrm.

0

Yes @kdvgent, I can confirm that the instructions from David Snopek works with the latest versions of Drupal and Civicrm. This is great.

I used "The full, manual process" with :

  • Drupal 8.6.4
  • CiviCRM 5.8.2

That was not easy. You need composer, bower, git and wget. Note that you cannot run the composer command as a root. This is a good habit. The script of David Snopek gather several installations process needed to use CiviCRM. It handles the multilanguage support. There is still several issues like the use of cron jobs and some extensions issues when using civi in multisite.

Your Answer

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

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