通过 Composer 安装 CakePHP 4.x 在插件安装程序上失败

CakePHP 4.x installation via Composer fails on plugin-installer

平台和目标:Debian 10 php 7.3.19-1~deb10u1

我安装了 Vag运行t 并尝试使用最新的 cake 版本创建一个新项目。在我的 vag运行t up 命令并通过 putty 登录后,我 运行 蛋糕网站上提供的命令。

composer create-project --prefer-dist cakephp/app:~4.0 my_app_name

发生了什么事

然后开始运行,安装基本的蛋糕应用程序,并尝试安装第一个插件。然后它崩溃并且不再执行任何操作。它抛出以下错误:

Creating a "cakephp/app:~4.0" project at "./my_app_name"
Installing cakephp/app (4.2.1)
  - Installing cakephp/app (4.2.1): Extracting archive
Created project in /var/www/my_app_name
Loading composer repositories with package information
Updating dependencies
Lock file operations: 91 installs, 0 updates, 0 removals
  - Locking cakephp/bake (2.3.0)
  - (...)
  - Locking webmozart/assert (1.9.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 91 installs, 0 updates, 0 removals
  - Installing cakephp/plugin-installer (1.3.1): Extracting archive
Plugin initialization failed (include(/var/www/my_app_name/vendor/cakephp/plugin-installer/src/Plugin.php): failed to open stream: No such file or directory), uninstalling plugin
  - Removing cakephp/plugin-installer (1.3.1)
    Install of cakephp/plugin-installer failed


  [RuntimeException]
  Could not delete /var/www/my_app_name/vendor/cakephp/plugin-installer/src:


create-project [-s|--stability STABILITY] [--prefer-source] [...more options...]

我尝试了 运行 --verbose 参数,但我并没有真正变得更聪明(您可以在 post 的底部找到它)。当我通过 github 和 运行 composer update 上的直接下载安装 cake 4.2 时,它工作得很好。当我直接在目录中安装 composer.phar 时,它再次给出完全相同的错误。

对这里可能出现的问题有什么想法吗?

我的 Vag运行t 设置

config.vm.box = 'bento/debian-10'

#!/usr/bin/env bash
echo "==> [ Entering bootstrap ]"

# VARS
DATABASE_NAME="webshop"

echo "==> Updating apt-get-get..."
apt-get update

echo "==> Installing/updating build-essential..."
apt-get install -y build-essential

# DOS2UNIX
if [ ! -f /usr/bin/dos2unix ]; then
    echo "==> Installing dos2unix..."
    apt-get install -y dos2unix
fi

# GIT
if [ ! -f /usr/bin/git ]; then
    echo "==> Installing GIT..."
    apt-get install -y git
fi

# APACHE
if [ ! -d /etc/apache2 ]; then
    echo "==> Installing Apache2..."
    apt-get install -y apache2
    a2enmod rewrite

    # Configure Apache
    echo "<VirtualHost *:80>
        DocumentRoot /var/www/webroot
        AllowEncodedSlashes On
        <Directory /var/www/webroot>
            Options +Indexes +FollowSymLinks
            DirectoryIndex index.php index.html
            Order allow,deny
            Allow from all
            AllowOverride All
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/vagrant_error.log
        CustomLog ${APACHE_LOG_DIR}/vagrant_access.log combined
    </VirtualHost>" > /etc/apache2/sites-available/000-default.conf
fi

# MYSQL
if [ ! -f /usr/bin/mariadb ]; then
    echo "==> Installing MySQL..."
    apt-get install -y mariadb-client mariadb-server

fi

echo "==> Creating databases..."
echo "CREATE DATABASE IF NOT EXISTS ${DATABASE_NAME} DEFAULT CHARACTER SET utf8" | mysql -uroot -proot
echo "CREATE DATABASE IF NOT EXISTS debug_kit DEFAULT CHARACTER SET utf8" | mysql -uroot -proot
echo "CREATE DATABASE IF NOT EXISTS test DEFAULT CHARACTER SET utf8" | mysql -uroot -proot
echo "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;" | mysql -uroot -proot
echo "flush privileges" | mysql -uroot -proot

# CURL
if [ ! -f /usr/bin/curl ]; then
    echo "==> Installing CURL..."
    apt-get install -y curl
fi

# PHP
if [ ! -f /usr/bin/php ]; then
    echo "==> Installing PHP..."
    # required by CakePHP
    apt-get install -y php7.3 php7.3-mbstring php7.3-intl php7.3-mysql
    # these are not...
    apt-get install -y php7.3-cli php7.3-curl php7.3-json php7.3-xdebug php7.3-zip
    # needed for phpunit
    apt-get install -y php7.3-xml php-zip
fi

if [ ! -f /usr/bin/zip ]; then
    apt-get install zip unzip
fi

# COMPOSER
if [ -e /usr/local/bin/composer ]; then
    /usr/local/bin/composer self-update
else
    curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
fi

# Reset home directory of vagrant user
if ! grep -q "cd /var/www" /home/vagrant/.profile; then
    echo "cd /var/www" >> /home/vagrant/.profile
fi

# RESTART
service apache2 restart
service mariadb restart

作曲家 --verbose

Exception trace:
 () at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:218
 Composer\Util\Filesystem->unlink() at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:171
 Composer\Util\Filesystem->removeDirectoryPhp() at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:138
 Composer\Util\Filesystem->removeDirectory() at phar:///usr/local/bin/composer/src/Composer/Downloader/FileDownloader.php:378
 Composer\Downloader\FileDownloader->remove() at phar:///usr/local/bin/composer/src/Composer/Downloader/DownloadManager.php:349
 Composer\Downloader\DownloadManager->remove() at phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:299
 Composer\Installer\LibraryInstaller->removeCode() at phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:189
 Composer\Installer\LibraryInstaller->uninstall() at phar:///usr/local/bin/composer/src/Composer/Installer/PluginInstaller.php:121
 Composer\Installer\PluginInstaller->rollbackInstall() at phar:///usr/local/bin/composer/src/Composer/Installer/PluginInstaller.php:79
 Composer\Installer\PluginInstaller->Composer\Installer\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/FulfilledPromise.php:20
 React\Promise\FulfilledPromise->then() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:74
 React\Promise\Deferred->React\Promise\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:166
 React\Promise\Deferred->processQueue() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:95
 React\Promise\Deferred->resolve() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/FulfilledPromise.php:20
 React\Promise\FulfilledPromise->then() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:76
 React\Promise\Deferred->React\Promise\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:166
 React\Promise\Deferred->processQueue() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:95
 React\Promise\Deferred->resolve() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/FulfilledPromise.php:20
 React\Promise\FulfilledPromise->then() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:76
 React\Promise\Deferred->React\Promise\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:166
 React\Promise\Deferred->processQueue() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:95
 React\Promise\Deferred->resolve() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/FulfilledPromise.php:20
 React\Promise\FulfilledPromise->then() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:76
 React\Promise\Deferred->React\Promise\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:166
 React\Promise\Deferred->processQueue() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:95
 React\Promise\Deferred->resolve() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/FulfilledPromise.php:20
 React\Promise\FulfilledPromise->then() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:76
 React\Promise\Deferred->React\Promise\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:166
 React\Promise\Deferred->processQueue() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Deferred.php:95
 React\Promise\Deferred->resolve() at phar:///usr/local/bin/composer/vendor/react/promise/src/React/Promise/Promise.php:42
 React\Promise\Promise->React\Promise\{closure}() at n/a:n/a
 call_user_func() at phar:///usr/local/bin/composer/src/Composer/Util/ProcessExecutor.php:284
 Composer\Util\ProcessExecutor->countActiveJobs() at phar:///usr/local/bin/composer/src/Composer/Util/Loop.php:95
 Composer\Util\Loop->wait() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:454
 Composer\Installer\InstallationManager->waitOnPromises() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:440
 Composer\Installer\InstallationManager->executeBatch() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:367
 Composer\Installer\InstallationManager->downloadAndExecuteBatch() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:266
 Composer\Installer\InstallationManager->execute() at phar:///usr/local/bin/composer/src/Composer/Installer.php:696
 Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:247
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:131
 Composer\Command\InstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:310
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:122
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:63
 require() at /usr/local/bin/composer:24

基于 &

composer update --prefer-source


--no-plugins 论点在某种程度上也有效。它跳过了一些包,但我的本地主机似乎工作得很好。这样速度更快,但缺少一些。