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

k2arahey  于 2022-11-12  发布在  PHP
关注(0)|答案(1)|浏览(165)

平台和目标:Debian 10的PHP版本
我已经安装了Vagrant,并试图用最新的蛋糕版本创建一个新项目。在我的Vagrant 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参数运行,但是我并没有变得更聪明(你可以在文章的底部找到这个)。当我通过github直接下载安装cake 4.2并运行composer update时,它运行得很好。当我直接在目录中安装composer.phar时,它又给出了完全相同的错误。
有什么想法可能是什么问题在这里?

我的流浪者设置

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

编写器--详细

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
e37o9pze

e37o9pze1#

基于https://stackoverflow.com/a/63139337/1110760https://stackoverflow.com/a/65627308/1110760
编写器更新--首选源
参数--no-plugins在某种程度上也能工作。它跳过了一些包,但我的localhost似乎工作得很好。这更快,但它缺少一些。

相关问题