Trouble installing via composer

Hi,

I’m trying to add a new new composer package to my project (twilio/sdk) but I get this error no matter what I try:

In this example I use composer update:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 50 installs, 0 updates, 0 removals

  • Installing cakephp/plugin-installer (1.2.0): Loading from cache
    PHP Fatal error: Uncaught Error: Class ‘Cake\Composer\Installer\PluginInstaller’ not found in phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php:202
    Stack trace:
    #0 phar:///usr/local/bin/composer/src/Composer/Installer/PluginInstaller.php(62): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage), true)
    #1 phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php(173): Composer\Installer\PluginInstaller->install(Object(Composer\Repository\InstalledFilesystemRepository), Object(Composer\Package\CompletePackage))
    #2 phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php(160): Composer\Installer\InstallationManager->install(Object(Composer\Repository\InstalledFilesystemRepository), Object(Composer\DependencyResolver\Operation\InstallOperation))
    #3 phar:///usr/local/bin/composer/src/Composer/Installer.php(611): Composer\Installer\InstallationManager->execute(Object(Composer\Repository\InstalledFilesystemRepository), Object(Composer\Depe in phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php on line 202

Fatal error: Uncaught Error: Class ‘Cake\Composer\Installer\PluginInstaller’ not found in phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php:202
Stack trace:
#0 phar:///usr/local/bin/composer/src/Composer/Installer/PluginInstaller.php(62): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage), true)
#1 phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php(173): Composer\Installer\PluginInstaller->install(Object(Composer\Repository\InstalledFilesystemRepository), Object(Composer\Package\CompletePackage))
#2 phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php(160): Composer\Installer\InstallationManager->install(Object(Composer\Repository\InstalledFilesystemRepository), Object(Composer\DependencyResolver\Operation\InstallOperation))
#3 phar:///usr/local/bin/composer/src/Composer/Installer.php(611): Composer\Installer\InstallationManager->execute(Object(Composer\Repository\InstalledFilesystemRepository), Object(Composer\Depe in phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php on line 202

Here are the require and require-dev lists I have in my composer.json file:

"require": { "php": ">=5.6.0", "cakephp/cakephp": "^3.7", "mobiledetect/mobiledetectlib": "2.*", "cakephp/migrations": "~1.0", "cakephp/plugin-installer": "^1.2", "xety/cake3-cookieauth": "1.*", "drewm/mailchimp-api": "^2.2", "josegonzalez/cakephp-upload": "^3.6", "imagine/imagine": "^0.6.3", "stripe/stripe-php": "^5.7", "crabstudio/recaptcha": "^2.1", "twilio/sdk": "^5.42" }, "require-dev": { "psy/psysh": "@stable", "cakephp/debug_kit": "~3.3", "cakephp/bake": "~1.1" },

What package are you trying to add? What version of composer do you have?

I’m trying to simply install these:

“require”: {

    "php": ">=5.6.0",

    "cakephp/cakephp": "^3.8",

    "cakephp/migrations": "~1.0",

    "cakephp/plugin-installer": "^1.2",

    "xety/cake3-cookieauth": "1.*",

    "drewm/mailchimp-api": "^2.2",

    "josegonzalez/cakephp-upload": "^3.6",

    "imagine/imagine": "^0.6.3",

    "crabstudio/recaptcha": "^2.1",

    "twilio/sdk": "^5.42"

},

composer version 1.10.5

Though I need to add --no-plugins to any composer command I run. eg:

image

composer update updates things to newer versions where applicable. composer install installs the packages that your composer.json requires, which seems to be what you want here.

Sure but I’m still getting the above error when I run composer install. Any ideas?

Is that saying a Cake-world tool cannot be found in a composer-world directory?

If so, it sounds like some path error in the command or installation of composer? Or a problem with installation of composer?

I’m at the guess-work edge of my knowledge here.

Seems to be yes. I’m having trouble tracking down what the issue might be though. I’ve reinstalled composer and still get the same issue.

No worries, appreciate you looking at it.

and to demonstrate what happens when I try to create a blank new cakephp project:

Yes, that works for me (in 4x).

here are the beginning output lines from the install:

Installing cakephp/app (4.0.3)
  - Installing cakephp/app (4.0.3): Loading from cache
Created project in example
Loading composer repositories with package information
Updating dependencies (including require-dev)
... more

Given where things fail in yours, is it possible there is a permissions problem that prevents a file from creation? (Though no error reports that).

Is there anything at vagrant/apps/test at the end of the process?