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

What does this message indicate? #19

Open
syzygy333 opened this issue Nov 2, 2023 · 10 comments
Open

What does this message indicate? #19

syzygy333 opened this issue Nov 2, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@syzygy333
Copy link

fatal: pathspec 'web' did not match any files

The script continues on just fine, so is this anything we should be paying attention to?

@rsanzante
Copy link
Member

That error message seems to come from git. A git command tried to do something with 'web' but that 'web' was not available when the command was run. Probably is this line:

$this->runCommand('git add web');

More info would be needed to dig into this. Are you suing a repository with a 'web' folder with the Drupal root?

@syzygy333
Copy link
Author

in this case, my project uses /docroot

@rsanzante
Copy link
Member

The recommended way is using [web](https://github.com/drupal/recommended-project/blob/d74f1b691fc63700b5c60f0b6af705ca7fe5c316/composer.json#L44) for the Drupal docroot, so that's the path the script uses.

However, you can create a symlink web that points to your docrootand it should work fine.

@rsanzante
Copy link
Member

We can try to add a way to set the Drupal root folder name so it i si possible to change web for something else, but while this is ready the previous workaround should work in your case.

@omarlopesino
Copy link
Member

I confirm is the line quoted here: #19 (comment) . That is done because the core updates may change docroot files (s.e.: default.settings.php).

It is true that web is the standard, but the error would persist by adding a symlink because git does not let add files using the symlink as a directory.

What do you think about using drupal-finder find the docroot @rsanzante ? If it works okay, we save time to add the folder and prevent this error when the command is launched without parameters.

@jorgetutor
Copy link
Member

IMHO we should prioritize automatic discovery over configuration, +1 to include drupal-finder

@rsanzante
Copy link
Member

Drupal-finderiwas used in Drush Launcher but Launcher was abandoned because is not compatible with Drush 12, see drush-ops/drush-launcher#105.

In that issue they state that drupal-finder requires some paths in composer.json, although I guess it is a special requirement because how they is finder. However, we would need to test it to be sure we don't hit the same wall.

Another simple option is to use drush:

drush status| grep "Drupal root" | cut -f2 -d:   

That should return the absolute path of the Drupal root. We can try this command, and if there's no error use the path returned, and if there's and error use the default web folder.

@rsanzante
Copy link
Member

ah, and the simplest one is to use an environment variable.
That is very easy to use and implement and should fit most of the cases.

@omarlopesino
Copy link
Member

Drupal-finderiwas used in Drush Launcher but Launcher was abandoned because is not compatible with Drush 12, see drush-ops/drush-launcher#105.

In that issue they state that drupal-finder requires some paths in composer.json, although I guess it is a special requirement because how they is finder. However, we would need to test it to be sure we don't hit the same wall.

Another simple option is to use drush:

drush status| grep "Drupal root" | cut -f2 -d:   

That should return the absolute path of the Drupal root. We can try this command, and if there's no error use the path returned, and if there's and error use the default web folder.

This is interesting. Now drush uses composer runtime ap, which lets know where a package is installed. So their drupal finder class looks where core is installedi: https://github.com/drush-ops/drush/blob/12.x/src/DrupalFinder/DrushDrupalFinder.php#L26 :

$core = InstalledVersions::getInstallPath('drupal/core');
As core is installed inside doc root, it is a good chance to do that.

Also, after talking together, we will work on detecting root by:

  1. Environment variable
  2. Detecting root, either by composer runtime API or drush status
  3. Web

If none of this was allows detecting the docroot, an error will be displayed assuming no drupal root has been found.

@syzygy333
Copy link
Author

wow, love the responsiveness. thanks all!

@omarlopesino omarlopesino added the bug Something isn't working label Nov 24, 2023
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