acquia / blt

Acquia's toolset for automating Drupal 8 and 9 development, testing, and deployment.
https://docs.acquia.com/blt/
GNU General Public License v2.0
442 stars 394 forks source link

Issue creating BLT templated files... #3874

Closed luiscolmenares closed 4 years ago

luiscolmenares commented 5 years ago

I want to... Add blt to an existing multisite project.

It's not working because... What's going wrong? While running composer install, I get this:

- sites/example.sites.php (https://git.drupalcode.org/project/drupal/raw/8.6.17/sites/example.sites.php): Downloading (100%)         
  - update.php (https://git.drupalcode.org/project/drupal/raw/8.6.17/update.php): Downloading (100%)         
  - web.config (https://git.drupalcode.org/project/drupal/raw/8.6.17/web.config): Downloading (100%)         
PHP CodeSniffer Config installed_paths set to ../../drupal/coder/coder_sniffer/
Creating BLT templated files...
 > /Users/me/Documents/Sites/CODEBASE/vendor/acquia/blt/bin/blt internal:add-to-project --ansi -y
PHP Warning:  require_once(/vendor/autoload.php): failed to open stream: No such file or directory in /Users/me/Documents/Sites/CODEBASE/vendor/acquia/blt/bin/blt-robo.php on line 8
PHP Fatal error:  require_once(): Failed opening required '/vendor/autoload.php' (include_path='.:/usr/local/Cellar/php@7.2/7.2.18/share/php@7.2/pear') in /Users/me/Documents/Sites/CODEBASE/vendor/acquia/blt/bin/blt-robo.php on line 8

Warning: require_once(/vendor/autoload.php): failed to open stream: No such file or directory in /Users/me/Documents/Sites/CODEBASE/vendor/acquia/blt/bin/blt-robo.php on line 8

Fatal error: require_once(): Failed opening required '/vendor/autoload.php' (include_path='.:/usr/local/Cellar/php@7.2/7.2.18/share/php@7.2/pear') in /Users/me/Documents/Sites/CODEBASE/vendor/acquia/blt/bin/blt-robo.php on line 8
BLT installation failed! Please execute /Users/me/Documents/Sites/CODEBASE/vendor/acquia/blt/bin/blt internal:add-to-project --ansi -y --verbose to debug the issue.

  [Exception]                        
  Installation aborted due to error  

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...

My-MacBook-Pro:CODEBASE me$ blt doctor
You must run this command from within a BLT-generated project.

blt doctor wont run yet, because of the issue while composer install.

I've also tried blt doctor while in the VM, I get this:

vagrant@local:/var/www/drupalvm/docroot$ blt doctor

Command 'blt' not found, did you mean:

  command 'llt' from deb storebackup
  command 'btt' from deb blktrace
  command 'bat' from deb bacula-console-qt
  command 'bls' from deb bacula-sd
  command 'bld' from deb bld
  command 'slt' from deb slt
  command 'lbt' from deb lbt
  command 'lt' from deb looptools

Try: sudo apt install <deb name>

Detailed error output Above

BLT doctor output No output

System information

danepowell commented 5 years ago

The problem is that BLT can't find the repo root in this function: https://github.com/acquia/blt/blob/11.x/bin/blt-robo.php#L23

There must be something wrong with your composer installation that the expected files in the vendor directory don't exist.

Can you run composer install -vvv and post the complete output, not just the last few lines? Use pastebin or add it as a text file to keep things tidy.

Were you using composer prior to requiring BLT? If so what's the directory structure of your project? Specifically, where are the docroot and vendor directory(s)?

Can you confirm that the following files exist?

Finally, confirm whether you've modified the composer binary directory (bin key) via composer.json. This is the most likely culprit I think.

BTW, I assume the output you posted is from BLT 9. Do not use BLT 9, only attempt to add BLT 10 going forward for the best results.

luiscolmenares commented 5 years ago

@danepowell

Can you run composer install -vvv and post the complete output, not just the last few lines? Use pastebin or add it as a text file to keep things tidy.

-Adding the composer install output as a text file. composerinstall.txt

Were you using composer prior to requiring BLT? If so what's the directory structure of your project? Specifically, where are the docroot and vendor directory(s)?

  • Yes, I was using composer install.
  • docroot and vendor directory(s)
    MacBook-Pro:SBD_CODEBASE me$ tree -v -L 1 --charset utf-8
    .
    ├── README.md
    ├── Vagrantfile
    ├── acquia
    ├── azure-pipelines-1.yml
    ├── azure-pipelines.yml
    ├── bin
    ├── bitbucket-pipelines.yml
    ├── blt
    ├── build-sf-lightning.sh
    ├── composer.json
    ├── composer.lock
    ├── config.yml
    ├── default.config.yml
    ├── **docroot**
    ├── docs
    ├── drush
    ├── factory-hooks
    ├── hooks
    ├── lib
    ├── libraries
    ├── patches
    ├── provisioning
    ├── scripts
    ├── shell_scripts
    └── **vendor**

Can you confirm that the following files exist?

/Users/me/Documents/Sites/CODEBASE/vendor/bin/blt It doesn't exist in the provided directory, however I found it here: /Users/me/Documents/Sites/CODEBASE/bin/blt

/Users/me/Documents/Sites/CODEBASE/vendor/autoload.php Yes, it is there.

Finally, confirm whether you've modified the composer binary directory (bin key) via composer.json. This is the most likely culprit I think.

    "name": "acquia/lightning-project",
    "description": "Project template for Drupal 8 sites built with the Lightning distribution.",
    "type": "project",
    "license": "GPL-2.0+",
    "minimum-stability": "dev",
    "prefer-stable": true,
    "require-dev": {
        "behat/behat": "^3.1",
        "drupal/drupal-extension": "^3.1",
        "behat/mink": "~1.6",
        "behat/mink-goutte-driver": "~1.2",
        "jcalderonzumba/gastonjs": "~1.0.2",
        "jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
        "mikey179/vfsstream": "~1.2",
        "phpunit/phpunit": "~4.8",
        "symfony/css-selector": "3.4.x-dev"
    },
    "require": {
        "composer/installers": "^1.0",
        "drupal-composer/drupal-scaffold": "^2.1.0",
        "cweagans/composer-patches": "^1.6.5",
        "acquia/lightning": "~3.2.8",
        "drupal/core": "^8.5.4",
        "drupal/externalauth": "1.x-dev",
        "drupal/samlauth": "^2.0",
        "drupal/admin_toolbar": "^1.24",
        "drupal/search_autocomplete": "^1.1",
        "drupal/image_url_formatter": "^1.0@beta",
        "drupal/twig_tweak": "^2.1",
        "drupal/block_styles": "^1.2",
        "drupal/fontawesome": "^1.4",
        "drupal/link_attributes": "^1.3",
        "drupal/styles_api": "^1.0",
        "drupal/bootstrap_layouts": "5.1",
        "drupal/geolocation": "^1.11",
        "drupal/google_map_field": "^1.4",
        "drupal/office_hours": "^1.1",
        "drupal/shariff": "^1.3",
        "drupal/adminimal_theme": "^1.3",
        "drupal/metatag": "^1.4",
        "drupal/redirect": "^1.2",
        "drupal/simple_sitemap": "^2.12",
        "drupal/sitemap": "^1.4",
        "drupal/robotstxt": "^1.2",
        "drupal/devel": "^2.0",
        "drupal/vardumper": "^1.4",
        "drupal/google_tag": "^1.0",
        "drupal/paragraphs": "^1.3",
        "drupal/lingotek": "^2.9",
        "drupal/smtp": "^1.0",
        "drupal/block_exclude_pages": "^1.2",
        "drupal/workbench_moderation": "^1.3",
        "drupal/acsf": "1.61",
        "drupal/backup_migrate": "^4.0",
        "drupal/menu_link_attributes": "^1.0",
        "drupal/yaml_editor": "^1.0",
        "drupal/content_sync": "^2.0",
        "drupal/css_editor": "^1.2",
        "drupal/swiftmailer": "^1.0@beta",
        "drupal/restui": "^1.16",
        "drush/drush": "9.*",
        "drupal/search_api_autocomplete": "^1.1",
        "drupal/webform": "^5.0",
        "drupal/mail_login": "^1.0",
        "drupal/email_registration": "^1.0@RC",
        "drupal/config_split": "^1.4",
        "drupal/auto_entityqueue": "^1.0",
        "drupal/address": "~1.0",
        "drupal/fontyourface": "^3.2",
        "drupal/simplify_menu": "^2.0",
        "drupal/menu_export": "^1.2",
        "drupal/extlink": "^1.1",
        "drupal/label_length_limit": "^1.1",
        "drupal/field_group": "^1.0",
        "drupal/language_switcher_extended": "^1.0@beta",
        "drupal/migrate_plus": "^4.2",
        "drupal/migrate_tools": "^4.1",
        "onelogin/php-saml": "dev-remove_mcrypt as 2.11.0",
        "drupal/menu_item_role_access": "^1.0",
        "drupal/dropdown_language": "^2.3",
        "drupal/bynder": "^2.4",
        "desandro/imagesloaded": "^4.1",
        "desandro/masonry": "^4.2",
        "acquia/blt": "^10.0.0"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "package",
            "package": {
                "name": "desandro/imagesloaded",
                "version": "v4.1.4",
                "type": "drupal-library",
                "dist": {
                    "url": "https://github.com/desandro/imagesloaded/archive/v4.1.4.zip",
                    "type": "zip"
                }
            }
        },
        {
            "type": "package",
            "package": {
                "name": "desandro/masonry",
                "version": "v4.2.2",
                "type": "drupal-library",
                "dist": {
                    "url": "https://github.com/desandro/masonry/archive/v4.2.2.zip",
                    "type": "zip"
                }
            }
        },
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    ],
    "scripts": {
        "post-install-cmd": [
            "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
            "Acquia\\Lightning\\ScriptHandler::deployLibraries"
        ],
        "post-update-cmd": [
            "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
            "Acquia\\Lightning\\ScriptHandler::deployLibraries"
        ]
    },
    "config": {
        "bin-dir": "bin/"
    },
    "autoload": {
        "classmap": [
            "scripts/ScriptHandler.php"
        ]
    },
    "extra": {
        "installer-paths": {
            "docroot/core": [
                "drupal/core"
            ],
            "docroot/libraries/{$name}": [
                "type:drupal-library"
            ],
            "docroot/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "docroot/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "docroot/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/contrib/{$name}": [
                "type:drupal-drush"
            ]
        },
        "enable-patching": true,
        "patches": {
            "drupal/bootstrap_layouts": {
                "Fix bug in the layout inheritance when using a custom layout. To be fixed soon in Drupal 8.5": "https://www.drupal.org/files/issues/bootstrap_layouts-find-layout-2906003-2.patch"
            },
            "drupal/contextual": {
                "Fix conflict with service centers implementation/geolocation": "patches/geolocation_contextual.patch"
            },
            "drupal/workbench_moderation": {
                "Workbench Moderation's `access_check.latest_revision` service ID conflicts with Content Moderation in core": "https://www.drupal.org/files/issues/2019-05-09/3034532-4.patch",
                "Fix  for problem uninstalling work bench moderation": "https://www.drupal.org/files/issues/workbench_moderation-fix_uninstall-2627012-34.patch"
            }
        }
    }
}

BTW, I assume the output you posted is from BLT 9. Do not use BLT 9, only attempt to add BLT 10 going forward for the best results.

danepowell commented 5 years ago

Remove this from your composer.json and I suspect it will work:

"config": {
    "bin-dir": "bin/"
},

To follow up: https://github.com/acquia/blt/issues/3886

luiscolmenares commented 5 years ago

@danepowell , it worked.

I need to confirm if this was intended for some reason.

I have output from blt doctor now:

+---------------------------+--------------------------------------------------------------+
| Property                  | Value                                                        |
+---------------------------+--------------------------------------------------------------+
| %paths.%root              | /Users/me/Documents/Sites/CODEBASE/docroot             |
| %paths.%site              | sites/default                                                |
| %paths.%modules           | sites/all/modules                                            |
| %paths.%themes            | sites/all/themes                                             |
| %paths.%config-sync       | /Users/me/Documents/Sites/CODEBASE/config/default      |
| alias-searchpaths.0       | /Users/me/.drush/sites                                     |
| alias-searchpaths.1       | /Users/me/Documents/Sites/CODEBASE/drush/sites         |
| blt-version               | 10.5.0                                                       |
| composer-version          | Composer version 1.9.0 2019-08-02 20:55:32                   |
| config-sync               | /Users/me/Documents/Sites/CODEBASE/config/default      |
| db-driver                 | mysql                                                        |
| db-hostname               | localhost                                                    |
| db-name                   | drupal                                                       |
| db-password               | drupal                                                       |
| db-port                   | 3306                                                         |
| db-username               | drupal                                                       |
| drupal-settings-file      | sites/default/settings.php                                   |
| drupal-version            | 8.7.8                                                        |
| drush-alias-files.0       | /Users/me/.drush/sites/drupalvm.site.yml                   |
| drush-alias-files.1       | /Users/me/.drush/sites/sbdinc.site.yml                     |
| drush-cache-directory     | /Users/me/.drush/cache                                     |
| drush-conf.0              | /Users/me/.drush/drush.yml                                 |
| drush-conf.1              | /Users/me/Documents/Sites/CODEBASE/vendor/drush/drush/ |
|                           | drush.yml                                                    |
| drush-conf.2              | /Users/me/Documents/Sites/CODEBASE/drush/drush.yml     |
| drush-conf.3              | /Users/me/Documents/Sites/CODEBASE/docroot/sites/defau |
|                           | lt/local.drush.yml                                           |
| drush-script              | /Users/me/Documents/Sites/CODEBASE/vendor/drush/drush/ |
|                           | drush                                                        |
| drush-temp                | /tmp                                                         |
| drush-version             | 9.7.1                                                        |
| modules                   | sites/all/modules                                            |
| php-bin                   | /usr/local/Cellar/php@7.2/7.2.18/bin/php                     |
| php-conf.0                | /usr/local/etc/php/7.2/php.ini                               |
| php-os                    | Darwin                                                       |
| root                      | /Users/me/Documents/Sites/CODEBASE/docroot             |
| site                      | sites/default                                                |
| stacks.drupal-vm.inited   | false                                                        |
| stacks.dev-desktop.inited | false                                                        |
| themes                    | sites/all/themes                                             |
| uri                       | http://local.blted10.com                                     |
+---------------------------+--------------------------------------------------------------+
+-------------------------------------------------------------+--------------------------------------------------------------+
| Check                                                       | Problem                                                      |
+-------------------------------------------------------------+--------------------------------------------------------------+
| ComposerCheck:composer.autoload.psr-4                       | The Composer configuration for autoload.psr-4 differs from   |
|                                                             | BLT's default, recommended values.                           |
|                                                             |   Change your configuration to match BLT's defaults in       |
|                                                             |                                                              |
|                                                             | vendor/acquia/blt/subtree-splits/blt-project/composer.json.  |
| ComposerCheck:composer.extra.installer-paths                | The Composer configuration for extra.installer-paths differs |
|                                                             | from BLT's default, recommended values.                      |
|                                                             |   Change your configuration to match BLT's defaults in       |
|                                                             |                                                              |
|                                                             | vendor/acquia/blt/subtree-splits/blt-project/composer.json.  |
| ComposerCheck:composer.extra.composer-exit-on-patch-failure | The Composer configuration for                               |
|                                                             | extra.composer-exit-on-patch-failure differs from BLT's      |
|                                                             | default, recommended values.                                 |
|                                                             |   Change your configuration to match BLT's defaults in       |
|                                                             |                                                              |
|                                                             | vendor/acquia/blt/subtree-splits/blt-project/composer.json.  |
| ComposerCheck:composer.extra.patchLevel                     | The Composer configuration for extra.patchLevel differs from |
|                                                             | BLT's default, recommended values.                           |
|                                                             |   Change your configuration to match BLT's defaults in       |
|                                                             |                                                              |
|                                                             | vendor/acquia/blt/subtree-splits/blt-project/composer.json.  |
| ComposerCheck:composer.repositories.drupal                  | The Composer configuration for repositories.drupal differs   |
|                                                             | from BLT's default, recommended values.                      |
|                                                             |   Change your configuration to match BLT's defaults in       |
|                                                             |                                                              |
|                                                             | vendor/acquia/blt/subtree-splits/blt-project/composer.json.  |
| ComposerCheck:composer.scripts.nuke                         | The Composer configuration for scripts.nuke differs from     |
|                                                             | BLT's default, recommended values.                           |
|                                                             |   Change your configuration to match BLT's defaults in       |
|                                                             |                                                              |
|                                                             | vendor/acquia/blt/subtree-splits/blt-project/composer.json.  |
| ComposerCheck:composer.scripts.drupal-scaffold              | The Composer configuration for scripts.drupal-scaffold       |
|                                                             | differs from BLT's default, recommended values.              |
|                                                             |   Change your configuration to match BLT's defaults in       |
|                                                             |                                                              |
|                                                             | vendor/acquia/blt/subtree-splits/blt-project/composer.json.  |
| ConfigCheck:checkGitConfig                                  | Git repositories are not defined in blt.yml.                 |
|                                                             |   Add values for git.remotes to blt.yml to enabled automated |
|                                                             | deployment.                                                  |
| DbCheck:checkDbConnection                                   | Could not connect to MySQL database.                         |
|                                                             |                                                              |
|                                                             | Is your *AMP stack running?                                  |
|                                                             | Are your database credentials correct?                       |
|                                                             |   db-driver: mysql                                           |
|                                                             |   db-hostname: localhost                                     |
|                                                             |   db-username: drupal                                        |
|                                                             |   db-password: drupal                                        |
|                                                             |   db-name: drupal                                            |
|                                                             |   db-port: 3306                                              |
|                                                             |                                                              |
|                                                             | To verify your mysql credentials, run `mysql -u drupal -h    |
|                                                             | localhost -pdrupal -P 3306`                                  |
|                                                             |                                                              |
|                                                             | Are you using the correct PHP binary?                        |
|                                                             | Is PHP using the correct MySQL socket?                       |
|                                                             |   php-os: Darwin                                             |
|                                                             |   php-bin: /usr/local/Cellar/php@7.2/7.2.18/bin/php          |
|                                                             |   php-conf: /usr/local/etc/php/7.2/php.ini                   |
|                                                             |                                                              |
|                                                             | Are you using the correct site and settings.php file?        |
|                                                             |   site: sites/default                                        |
|                                                             |   drupal-settings-file: sites/default/settings.php           |
|                                                             |                                                              |
|                                                             | To verify, run `drush sqlc`                                  |
|                                                             |                                                              |
| DrupalCheck:checkDrupalBootstrapped                         | Could not bootstrap Drupal via drush without alias.          |
| DrupalCheck:checkDrupalInstalled                            | Drupal is not installed.                                     |
|                                                             |                                                              |
|                                                             | Run `blt drupal:install` to install Drupal locally.          |
| FileSystemCheck:checkFileSystem:%files                      | Public files directory is not set.                           |
| FileSystemCheck:checkFileSystem:%private                    | Private files directory is not set.                          |
| FileSystemCheck:checkFileSystem:%temp                       | Temporary files directory is not set.                        |
| NodeCheck:checkNodeVersionFileExists                        | Neither .nvmrc nor .node-version file found in repo root.    |
| PhpCheck:checkPhpDateTimezone                               | PHP setting for date.timezone is not set.                    |
|                                                             |   Define date.timezone in /usr/local/etc/php/7.2/php.ini     |
| WebUriCheck:checkUriResponse                                | Did not get a response from http://local.blted10.com         |
|                                                             | Is your *AMP stack running?                                  |
|                                                             | Is your /etc/hosts file correctly configured?                |
|                                                             | Is your web server configured to serve this URI from         |
|                                                             | /Users/me/Documents/Sites/CODEBASE/docroot?            |
|                                                             | Is options.uri set correctly in                              |
|                                                             | /Users/me/Documents/Sites/CODEBASE/docroot/sites/defau |
|                                                             | lt/local.drush.yml?                                          |
+-------------------------------------------------------------+--------------------------------------------------------------+
[error]  BLT Doctor discovered one or more critical issues.
For troubleshooting guidance and support, see https://docs.acquia.com/blt/faq/ 

Thank you.

danepowell commented 4 years ago

You should clean up your composer.json to match what BLT doctor is recommending. In general, you might have an easier time just copying BLT's template composer.json into your project and adding any custom dependencies: https://github.com/acquia/blt-project/blob/10.x/composer.json

no-response[bot] commented 4 years ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.