When I try to run drush dmu-analyze my_module, I get this error:

[mikl:~/Sites … okmeister/modules/bookmeister_bookmark] % drush dmu-analyze bookmeister_bookmark
require_once(modules/drupalmoduleupgrader/vendor/autoload.php): failed to open stream: No such file or directory [warning]
drupalmoduleupgrader.drush.inc:75

Fatal error: require_once(): Failed opening required 'modules/drupalmoduleupgrader/vendor/autoload.php' (include_path='/Users/mikl/Sites/d8/core/vendor/phpunit/php-text-template:/Users/mikl/Sites/d8/core/vendor/phpunit/php-timer:/Users/mikl/Sites/d8/core/vendor/phpunit/php-token-stream:/Users/mikl/Sites/d8/core/vendor/phpunit/php-file-iterator:/Users/mikl/Sites/d8/core/vendor/phpunit/php-code-coverage:/Users/mikl/Sites/d8/core/vendor/phpunit/phpunit:/Users/mikl/Sites/d8/core/vendor/symfony/yaml:/Users/mikl/Sites/d8/core/vendor/phpunit/phpunit-mock-objects:/usr/local/Cellar/drush/HEAD/libexec/vendor/phpunit/php-token-stream:/usr/local/Cellar/drush/HEAD/libexec/vendor/phpunit/php-text-template:/usr/local/Cellar/drush/HEAD/libexec/vendor/phpunit/phpunit-mock-objects:/usr/local/Cellar/drush/HEAD/libexec/vendor/phpunit/php-timer:/usr/local/Cellar/drush/HEAD/libexec/vendor/phpunit/php-file-iterator:/usr/local/Cellar/drush/HEAD/libexec/vendor/phpunit/php-code-coverage:/usr/local/Cellar/drush/HEAD/libexec/vendor/phpunit/phpunit:/ in /Users/mikl/Sites/d8/modules/drupalmoduleupgrader/drupalmoduleupgrader.drush.inc on line 75
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: require_once(): Failed opening required 'modules/drupalmoduleupgrader/vendor/autoload.php'
(include_path='/Users/mikl/Sites/d8/core/vendor/phpunit/php-text-template:/Users/mikl/Sites/d8/core/vendor/phpunit/php-timer:/Users/mikl/Sites/d8/core/vendor/phpunit/php-token-stream:/Users/mikl/Sites/d8/core/vendor/phpunit/php-file-iterator:/Users/mikl/Sites/d8/core/vendor/phpunit/php-code-coverage:/Users/mikl/Sites/d8/core/vendor/phpunit/phpunit:/Users/mikl/Sites/d8/core/vendor/symfony/yaml:/Users/mikl/Sites/d8/core/vendor/phpunit/phpunit-mock-objects:/usr/local/Cellar/drush/HEAD/libexec/vendor/phpunit/php-token-stream:/usr/local/Cellar/drush/HEAD/libexec/vendor/phpunit/php-text-template:/usr/local/Cellar/drush/HEAD/libexec/vendor/phpunit/phpunit-mock-objects:/usr/local/Cellar/drush/HEAD/libexec/vendor/phpunit/php-timer:/usr/local/Cellar/drush/HEAD/libexec/vendor/phpunit/php-file-iterator:/usr/local/Cellar/drush/HEAD/libexec/vendor/phpunit/php-code-coverage:/usr/local/Cellar/drush/HEAD/libexec/vendor/phpunit/phpunit:/
in /Users/mikl/Sites/d8/modules/drupalmoduleupgrader/drupalmoduleupgrader.drush.inc, line 75

I'm using the latest version of Drush and the latest version of this module.

Comments

mikl’s picture

Ah, this is what happens when you don't read the README file, which states you must go in to modules/drupalmoduleupgrader and run composer install

webchick’s picture

Priority: Normal » Major

Still, we could stand to fail a bit more gracefully here.

  • phenaproxima committed c8c8e23 on master
    Issue #2349513: Error: require_once(): Failed opening required 'modules/...
phenaproxima’s picture

Status: Active » Needs review

I concur. I have made it much smarter; it'll check for autoload.php before trying to do anything, and set an error message if it's not found.

mikl’s picture

Shouldn't you do an exit() or similar after calling drush_set_error()? Otherwise, I guess the execution would continue and throw other interesting errors about the missing code…

phenaproxima’s picture

@mikl: That's what I thought initially, but drush seems to exit as soon as drush_set_error() is called in a validation callback. Which is fine by me, since that allows Drush to do whatever cleanup/pre-exit tasks it needs to do.

webchick’s picture

Status: Needs review » Fixed
autoload.php not found! Did you remember to run composer install?                                               [error]

Lovely!

  • webchick committed 866c88a on 8.x-1.x authored by phenaproxima
    Issue #2349513: Error: require_once(): Failed opening required 'modules/...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

nigelcunningham’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new541 bytes

Sorry to reopen this, but I'd argue that the message is not helpful. It says nothing about needing to cd to upgrader directory first, so the natural assumption is that you need to run composer install from the site root (achieving nothing). The message should be modified to say that you need to run composer install from the drush directory.

The attached patch does this.

webchick’s picture

Status: Needs review » Fixed

Nice improvement, thanks!

Committed and pushed to 8.x-1.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.