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

/app/bin and wrong PATH #2328

Closed
com2 opened this issue Jun 3, 2020 · 4 comments
Closed

/app/bin and wrong PATH #2328

com2 opened this issue Jun 3, 2020 · 4 comments
Assignees

Comments

@com2
Copy link

com2 commented Jun 3, 2020

I tried to switch to Drush 10 in preparation for Drupal 9. Setting in .lando.yml:

config:
  drush: '10'

will result in a broken drush. I therefore remove the change and did:

lando composer require --dev drush/drush

Supposedly according to Lando documentation this should be sufficient, but that resulted in:

lando drush --version
 Drush Version   :  8.3.2 

When I check my app folder I don't see /app/vendor/bin where usually I find drush. I then discover it in /app/bin which is fine. But then I do:

lando ssh -c "printenv |grep PATH"
/app/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/www/.composer/vendor/bin

.. and I don't quite understand the /app/vendor/bin when I guess it should have been really /app/bin .
Then I try :

lando ssh -c "ls -l /var/www/.composer/bin"
ls: cannot access '/var/www/.composer/bin': No such file or directory

... which makes me put a question mark why it would be included as last in PATH. I know I can work around it with tooling, but it would have be nice when at least the first PATH entry would be /app/bin in future releases.

@pirog
Copy link
Sponsor Member

pirog commented Jun 3, 2020

@com2 if its ending up in /app/bin its because your composer config has been set to install drush there.
https://getcomposer.org/doc/articles/vendor-binaries.md#can-vendor-binaries-be-installed-somewhere-other-than-vendor-bin-

The default location is /app/vendor/bin which we account for in PATH. We cannot set PATH to work with all possible custom composer settings for, i hope, obvious reasons.

This is actually documented
https://docs.lando.dev/config/drupal8.html#using-a-site-local-drush

If you find that Lando is not using your drush as expected, which can happen if you've modified composer to install in a different directory than its normal vendor, you can take advantage of Lando's tooling overrides and specify an absolute path to your Drush.

Please RTFM

@pirog pirog closed this as completed Jun 3, 2020
@com2
Copy link
Author

com2 commented Jun 4, 2020

Thanks for your patient advice to RTFM. Aparently ignorance is curse here.

There was a "config": { "bin-dir": "bin"} in my composer.json. The simpler solution here is to remove that and do a lando composer install which will create new sim-links in vendor/bin

@pirog pirog reopened this Jun 4, 2020
@pirog pirog self-assigned this Jun 4, 2020
@pirog pirog added this to the 3.0.x-JUNE2020 milestone Jun 4, 2020
@pirog
Copy link
Sponsor Member

pirog commented Jun 4, 2020

@com2 we decided to actually include /app/bin in our PATH as a fallback, it seems like this is a popular enough second choice for a lot of people.

This will be in the next release.

@com2
Copy link
Author

com2 commented Jun 9, 2020

Well that is really cool. Thank you!

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

2 participants