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

ScriptHandler execution fails while running composer commands with --no-install flag #602

Closed
bhanu951 opened this issue Jun 9, 2021 · 1 comment

Comments

@bhanu951
Copy link

bhanu951 commented Jun 9, 2021

Issue :

ScriptHandler execution fails while running composer commands with --no-install flag

Use case :

If I wanted to add additional modules or any other packages without actually downloading them I execute the composer commands with --no-install flag.

For example if I wanted to add devel module to the project and update composer.lock file I execute the following command

composer require --dev --no-install 'drupal/devel:^4.1'

But as the required classes are not present ScriptHandler currently throws error


$ composer require --dev --no-install 'drupal/devel:^4.1'
./composer.json has been updated
Running composer update drupal/devel
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies
Lock file operations: 154 installs, 0 updates, 0 removals
  - Locking asm89/stack-cors (1.3.0)
  - Locking behat/mink (v1.8.1)
  - Locking behat/mink-browserkit-driver (v1.3.4)
...........
...........
  - Locking webflo/drupal-finder (1.2.2)
  - Locking webmozart/assert (1.10.0)
  - Locking webmozart/path-util (2.3.0)
  - Locking zaporylie/composer-drupal-optimizations (1.2.0)
Writing lock file
51 package suggestions were added by new dependencies, use `composer suggest` to see details.
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
> DrupalProject\composer\ScriptHandler::createRequiredFiles
PHP Fatal error:  Uncaught Error: Class 'DrupalFinder\DrupalFinder' not found in C:\xampp\htdocs\drupal-project\scripts\composer\ScriptHandler.php:21
Stack trace:
#0 phar://C:/Users/<username>/AppData/Local/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(341): DrupalProject\composer\ScriptHandler::createRequiredFiles(Object(Composer\Script\Event))
#1 phar://C:/Users/<username>/AppData/Local/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(220): Composer\EventDispatcher\EventDispatcher->executeEventPhpScript('DrupalProject\\c...', 'createRequiredF...', Object(Composer\Script\Event))
#2 phar://C:/Users/<username>/AppData/Local/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(102): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Script\Event))
#3 phar://C:/Users/<username>/AppData/Local/ComposerSetup/bin/composer.phar/src/Composer/Installer.php(341): Composer\EventDispatcher\EventDispatcher->dispatchScript('post-update-cmd', true in C:\xampp\htdocs\drupal-project\scripts\composer\ScriptHandler.php on line 21

Fatal error: Uncaught Error: Class 'DrupalFinder\DrupalFinder' not found in C:\xampp\htdocs\drupal-project\scripts\composer\ScriptHandler.php:21
Stack trace:
#0 phar://C:/Users/<username>/AppData/Local/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(341): DrupalProject\composer\ScriptHandler::createRequiredFiles(Object(Composer\Script\Event))
#1 phar://C:/Users/<username>/AppData/Local/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(220): Composer\EventDispatcher\EventDispatcher->executeEventPhpScript('DrupalProject\\c...', 'createRequiredF...', Object(Composer\Script\Event))
#2 phar://C:/Users/<username>/AppData/Local/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(102): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Script\Event))
#3 phar://C:/Users/<username>/AppData/Local/ComposerSetup/bin/composer.phar/src/Composer/Installer.php(341): Composer\EventDispatcher\EventDispatcher->dispatchScript('post-update-cmd', true in C:\xampp\htdocs\drupal-project\scripts\composer\ScriptHandler.php on line 21

Proposed Solution:

To fix this check for class existence and execute the script in ScriptHandler file. If needed throw a notice stating class not exist hence skipped execution of script.

@AlexSkrypnyk
Copy link
Collaborator

This pull request/issue has been inactive for over a year and is being closed due to inactivity. If the issue still persists or the contribution is still relevant, please feel free to reopen it or create a new one.

Thank you for your understanding and your contributions to the 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

2 participants