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

Problem detecting DrupalRoot on Drupal 8.7 #46

Open
Etroid opened this issue Aug 5, 2019 · 10 comments
Open

Problem detecting DrupalRoot on Drupal 8.7 #46

Etroid opened this issue Aug 5, 2019 · 10 comments

Comments

@Etroid
Copy link

Etroid commented Aug 5, 2019

DrupalFinder is unable to detect drupalRoot is /web when using drupal core 8.7 - using wikimedia/composer-merge-plugin. Instead, it thinks the drupalRoot is /.

This issue occurs when running any drush or drupal command.

{
  "require": {
    "drupal/console": "~1.0",
    "drupal/core": "^8.7",
    "drush/drush": "^9.2"
  },
  "extra": {
    "installer-paths": {
      "web/core": [
        "type:drupal-core"
      ],
      "web/modules/contrib/{$name}": [
        "type:drupal-module"
      ],
      "web/profiles/contrib/{$name}": [
        "type:drupal-profile"
      ],
      "web/themes/contrib/{$name}": [
        "type:drupal-theme"
      ],
      "drush/contrib/{$name}": [
        "type:drupal-drush"
      ]
    }
  }
}

From what I gather this is because of a recent change to support Drupal core 8.8 (i.e. https://www.drupal.org/project/drupal/issues/2912387#comment-13188592)

@webflo
Copy link
Owner

webflo commented Aug 6, 2019

Did you specify a name property in your composer.json?

@Etroid
Copy link
Author

Etroid commented Aug 6, 2019

yes, the snippet is just part of the entire composer.json file All was working last week, a few days before the latest release of drupal-finder

@simesy
Copy link

simesy commented Sep 16, 2019

Check if your main project composer.json is set to:

{
    "name": "drupal/drupal",
    ...

I had an old project I inherited that must have been initially modelled on the drupal composer.json. The update on Aug 2 added logic that looks for drupal/drupal and sets the Drupal Root incorrectly.

I'm guessing this was webflo's hunch...

@simesy
Copy link

simesy commented Sep 16, 2019

Something to note, this problem didn't occur for me when the entry point was Drush launcher. It only occured when i was explicitly doing like ../vendor/bin/drush status from the Drupal root.

@Etroid
Copy link
Author

Etroid commented Sep 16, 2019

^^ @simesy correct, I was not using drush launcher when I encountered the problem. It was working before the latest release however.

@simesy
Copy link

simesy commented Sep 16, 2019

@Etroid you haven't verified what that value of "name" is in your composer.json.

@Etroid
Copy link
Author

Etroid commented Sep 16, 2019

@simesy, name is "name": "tableau/www" so should not be related.

@Techwolf12
Copy link

Techwolf12 commented Sep 23, 2019

Same issue here, using the lightning distribution.
"name": "drupal/drupal",

Except the composer.json isn't in the docroot, but one directory outside of it for security reasons.
I think that is related to the issue. I downgraded to 1.1.0 for now to get it working.
So a quick fix:
composer require webflo/drupal-finder:1.1.0

@simesy
Copy link

simesy commented Sep 23, 2019

@Techwolf12 yeah that is pretty standard, drupal-finder is designed start in the docroot and look up a directory for the composer file.

"name": "drupal/drupal", is arguably incorrect because it collides with the well known composer package drupal/drupal, see attached image as evidence that Composer assumes this would never happen. It works because you're likely requiring bringing in the composer-friendly variation drupal/core.

I would change it. I've never seen negative consequences of changing it. I usually change it to ORGANISATION/PROJECT.

Screen Shot 2019-09-24 at 9 49 04 AM

@pjcdawkins
Copy link

Or remove it, there's no need for a "name" in a not-published Composer project.

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

5 participants