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

Lightning - Could not find autoload file #102

Closed
amitgoyal opened this issue Sep 6, 2019 · 7 comments
Closed

Lightning - Could not find autoload file #102

amitgoyal opened this issue Sep 6, 2019 · 7 comments
Labels
bug Something isn't working

Comments

@amitgoyal
Copy link

We have setup Lightning locally as per the steps below,

git clone --branch 8.x-4.x https://git.drupalcode.org/project/lightning.git
composer install

We have also setup drupal-check at project level and trying to run it against couple of Lightning modules but getting "Could not find autoload file." error,

➜ lightning git:(8.x-4.x) ✗ ./vendor/bin/drupal-check -d docroot/modules/contrib/lightning_layout

Could not find autoload file.

We tried to debug this by printing $this->vendorRoot at line 108 in /lightning/vendor/mglaman/drupal-check/src/Command/CheckCommand.php and got

this->vendorRoot: /lightning/docroot/modules/contrib/lightning_layout/vendor

Not sure if it should look for "vendor" folder at root level or "lightning_layout/vendor".

We are able to run drupal-check against other modules successfully which are part of Lightning,
➜ lightning git:(8.x-4.x) ✗ ./vendor/bin/drupal-check -d docroot/modules/contrib/token

Any idea?

@grasmash
Copy link

I had this issue with lightning_core. It is because DrupalCheck incorrectly assumes that lightning_core is the docroot.

@amitgoyal
Copy link
Author

BTW, we had temporarily hard coded "this->vendorRoot" in /lightning/vendor/mglaman/drupal-check/src/Command/CheckCommand.php to test the deprecations for Lightning modules.

That way we were able to progress for the time being.

@grasmash
Copy link

I see in the docs that there's a --drupal-root option for Drupal Check. Trying that now.

@grasmash
Copy link

Ah, it looks like that's not actually in a released version. I submitted a PR for achieving this with an environmental variable, which may no longer be necessary:
#103

@fgm
Copy link

fgm commented Apr 21, 2020

This does not solve the issue (not even Lightning-specific): the code incorrectly assumes $this->vendorDir is in one level below $this->rootDir, although in composer-project or drupal-recommended layouts it is an "uncle" of the rootDir. It could find the vendor location using the Composer libraries instead of guessing, but doesn't do it.

@mglaman mglaman added the bug Something isn't working label May 11, 2020
@mglaman
Copy link
Owner

mglaman commented May 11, 2020

        $drupalFinder->locateRoot($drupalRootCandidate);
        $this->drupalRoot = $drupalFinder->getDrupalRoot();
        $this->vendorRoot = $drupalFinder->getVendorDir();

We directories are determined by the Drupal finder library. It doesn't make any assumptions beyond that. It just passes the Drupal root value to mglaman/phpstan-drupal.

@mglaman mglaman mentioned this issue May 11, 2020
@fgm
Copy link

fgm commented May 11, 2020

Yes, the problem is in the drupalFinder resolution, as described above. The question is whether there is a way to initialize the finder to avoid the problem.

@mglaman mglaman closed this as completed Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants