Docker 上的 magento2 错误:"setup" 命名空间中没有定义任何命令
magento2 error on Docker: There are no commands defined in the "setup" namespace
我正在 Docker 容器中安装 magento2,如下所示 OS。
Linux 8791be8c3c43 5.0.0-23-generic #24~18.04.1-Ubuntu SMP Mon Jul 29 16:12:28 UTC 2019 x86_64 GNU/Linux
当我尝试使用以下命令和参数设置 magento 时,出现错误:
There are no commands defined in the "setup" namespace.
bin/magento setup:install \
--base-url=http://localhost/magento2 \
--db-host=localhost \
--db-name=magento \
--db-user=magento \
--db-password=magento \
--backend-frontname=admin \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email=admin@admin.com \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1
根据一些 post 我发现我 运行 下面的这个命令,它似乎显示了 magento 设置中的问题。最后一个错误,引用 SODIUM 的错误我通过安装钠扩展解决了。其他好像也解决了。
magento@8791be8c3c43:/var/www/html/magento2$ php bin/magento list
Magento CLI 2.3.2
In ServiceManager.php line 1130:
An abstract factory could not create an instance of magentosetupconsolecommandbackupcommand(alias: Magento\Setup\Console\Command\BackupCommand).
In ServiceManager.php line 941:
An exception was raised while creating "Magento\Setup\Console\Command\BackupCommand"; no instance returned
In Di.php line 865:
Missing instance/object for parameter maintenanceMode for Magento\Setup\Console\Command\BackupCommand::__construct
In ServiceManager.php line 1130:
An abstract factory could not create an instance of magentoframeworkappmaintenancemode(alias: Magento\Framework\App\MaintenanceMode).
In ServiceManager.php line 941:
An exception was raised while creating "Magento\Framework\App\MaintenanceMode"; no instance returned
In ErrorHandler.php line 61:
Warning: Use of undefined constant SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13 - assumed 'SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13' (this will throw an Error in a future version of PHP) in /var/www/html/magento2/
lib/internal/Magento/Framework/Encryption/Encryptor.php on line 153
我尝试按照我在某些 post 中找到的一些步骤来解决问题,例如删除以下目录的内容,然后尝试执行 php bin/magento cache:flush
和 php bin/magento setup:upgrade
但是我尝试 运行 以 php bin/magento...
开始的任何事情都会给我错误:There are no commands defined in the "xxxxxx" namespace.
rm -Rf var/cache/*
rm -Rf var/generation/*
我找到的一些解决方案是基于修复权限文件夹问题,但我相信我没有权限问题,因为我的 "magento" 用户是安装文件夹所有者组的成员(请参阅下面的代码),并且composer 是与 "magento" 用户一起安装的,没有抛出任何错误。
# Create a new user and group, which will be Magento file system owner
useradd -m -U -r -d /opt/magento magento -s /bin/bash && \
# Add the magento user to the www-data group and change the /opt/magento directory permissions so that the Nginx can access the Magento installation:
usermod -a -G www-data magento && \
chmod 750 /opt/magento && \
wget https://github.com/magento/magento2/archive/2.3.2.tar.gz && \
tar -xzvf 2.3.2.tar.gz && \
chown -R www-data:www-data /var/www/html/magento2-2.3.2/ && \
chmod -R 775 /var/www/html/magento2-2.3.2/ && \
mv magento2-2.3.2/ magento2 && \
rm 2.3.2.tar.gz && \
cd magento2 && \
su magento && \
非常欢迎任何解决此问题的想法。
我运行遇到了类似的问题,这是由于 libsodium 版本 (1.0.11)。
您可以安装更新的版本,请参阅 https://github.com/magento/magento2/issues/23405
将此添加到我的 docker 文件中很有用:
RUN echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list
RUN apt-get update && apt-get -t stretch-backports install -y libsodium-dev
RUN pecl install -f libsodium-1.0.17
我正在 Docker 容器中安装 magento2,如下所示 OS。
Linux 8791be8c3c43 5.0.0-23-generic #24~18.04.1-Ubuntu SMP Mon Jul 29 16:12:28 UTC 2019 x86_64 GNU/Linux
当我尝试使用以下命令和参数设置 magento 时,出现错误:
There are no commands defined in the "setup" namespace.
bin/magento setup:install \
--base-url=http://localhost/magento2 \
--db-host=localhost \
--db-name=magento \
--db-user=magento \
--db-password=magento \
--backend-frontname=admin \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email=admin@admin.com \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1
根据一些 post 我发现我 运行 下面的这个命令,它似乎显示了 magento 设置中的问题。最后一个错误,引用 SODIUM 的错误我通过安装钠扩展解决了。其他好像也解决了。
magento@8791be8c3c43:/var/www/html/magento2$ php bin/magento list
Magento CLI 2.3.2
In ServiceManager.php line 1130:
An abstract factory could not create an instance of magentosetupconsolecommandbackupcommand(alias: Magento\Setup\Console\Command\BackupCommand).
In ServiceManager.php line 941:
An exception was raised while creating "Magento\Setup\Console\Command\BackupCommand"; no instance returned
In Di.php line 865:
Missing instance/object for parameter maintenanceMode for Magento\Setup\Console\Command\BackupCommand::__construct
In ServiceManager.php line 1130:
An abstract factory could not create an instance of magentoframeworkappmaintenancemode(alias: Magento\Framework\App\MaintenanceMode).
In ServiceManager.php line 941:
An exception was raised while creating "Magento\Framework\App\MaintenanceMode"; no instance returned
In ErrorHandler.php line 61:
Warning: Use of undefined constant SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13 - assumed 'SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13' (this will throw an Error in a future version of PHP) in /var/www/html/magento2/
lib/internal/Magento/Framework/Encryption/Encryptor.php on line 153
我尝试按照我在某些 post 中找到的一些步骤来解决问题,例如删除以下目录的内容,然后尝试执行 php bin/magento cache:flush
和 php bin/magento setup:upgrade
但是我尝试 运行 以 php bin/magento...
开始的任何事情都会给我错误:There are no commands defined in the "xxxxxx" namespace.
rm -Rf var/cache/*
rm -Rf var/generation/*
我找到的一些解决方案是基于修复权限文件夹问题,但我相信我没有权限问题,因为我的 "magento" 用户是安装文件夹所有者组的成员(请参阅下面的代码),并且composer 是与 "magento" 用户一起安装的,没有抛出任何错误。
# Create a new user and group, which will be Magento file system owner
useradd -m -U -r -d /opt/magento magento -s /bin/bash && \
# Add the magento user to the www-data group and change the /opt/magento directory permissions so that the Nginx can access the Magento installation:
usermod -a -G www-data magento && \
chmod 750 /opt/magento && \
wget https://github.com/magento/magento2/archive/2.3.2.tar.gz && \
tar -xzvf 2.3.2.tar.gz && \
chown -R www-data:www-data /var/www/html/magento2-2.3.2/ && \
chmod -R 775 /var/www/html/magento2-2.3.2/ && \
mv magento2-2.3.2/ magento2 && \
rm 2.3.2.tar.gz && \
cd magento2 && \
su magento && \
非常欢迎任何解决此问题的想法。
我运行遇到了类似的问题,这是由于 libsodium 版本 (1.0.11)。
您可以安装更新的版本,请参阅 https://github.com/magento/magento2/issues/23405
将此添加到我的 docker 文件中很有用:
RUN echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list
RUN apt-get update && apt-get -t stretch-backports install -y libsodium-dev
RUN pecl install -f libsodium-1.0.17