dth981485742 2019-08-12 16:27
浏览 167

Docker上的magento2错误:“setup”命名空间中没有定义命令

I'm installating magento2 in a Docker container with OS as below.

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

When I try to setup magento with the command and parameters below and I get the error: 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

As per some post I've found I ran this command below, it seems that it displays issues in the magento setup. The last error, the one making reference to SODIUM I solved by installing sodium extension. The others seems to be solved too.

enter image description here

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 

I tried to solve the issue by following some steps I've found in some post, like removing the content of the directories below, then trying to execute php bin/magento cache:flush and php bin/magento setup:upgrade but anything I try to run starting with php bin/magento..... gets me the error: There are no commands defined in the "xxxxxx" namespace.

rm -Rf var/cache/*
rm -Rf var/generation/*

Some solutions I found were based on fixing permissions folder issues, but I believe I have no permission issues, as my "magento" user is member of owner group of installation folder (see my code below), and composer was installed with "magento" user and no errors were thrown.

   # 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 && \

Any ideas to troubleshoot this issue are very welcome, thanks in advanced.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
    • ¥65 汇编语言除法溢出问题
    • ¥15 Visual Studio问题
    • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
    • ¥20 求一个html代码,有偿
    • ¥100 关于使用MATLAB中copularnd函数的问题
    • ¥20 在虚拟机的pycharm上
    • ¥15 jupyterthemes 设置完毕后没有效果
    • ¥15 matlab图像高斯低通滤波
    • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗