昨天我尝试安装Magento 2.当试图访问前端时,我在网站的前端和Magento 2管理员都遇到了很多错误。由于这是我第一次不确定这些错误是什么以及如何解决它们。你能帮忙吗?
店面:
1 exception(s):
Exception #0 (UnexpectedValueException): Setup version for module 'MSP_AdminRestriction' is not specified
Exception #0 (UnexpectedValueException): Setup version for module 'MSP_AdminRestriction' is not specified #0 /home/ar26/projects/fv/html/vendor/magento/framework/Module/DbVersionInfo.php(56):
Magento\Framework\Module\DbVersionInfo->isModuleVersionEqual('MSP_AdminRestri...', '0.1.3')
#1 /home/ar26/projects/fv/html/vendor/magento/framework/Module/DbVersionInfo.php(79):
Magento\Framework\Module\DbVersionInfo->isSchemaUpToDate('MSP_AdminRestri...')
#2 /home/ar26/projects/fv/html/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(55):
Magento\Framework\Module\DbVersionInfo->getDbVersionErrors()
#3 /home/ar26/projects/fv/html/vendor/magento/framework/Interception/Chain/Chain.php(67):
Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor),
Object(Closure), Object(Magento\Framework\App\Request\Http))
#4 /home/ar26/projects/fv/html/vendor/magento/framework/Interception/Chain/Chain.php(63):
Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor),
Array, 'front-controlle...')
#5 /home/ar26/projects/fv/html/vendor/magento/module-page-cache/Model/App/FrontController/VarnishPlugin.php(55):
Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#6 /home/ar26/projects/fv/html/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\PageCache\Model\App\FrontController\VarnishPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor),
Object(Closure), Object(Magento\Framework\App\Request\Http))
#7 /home/ar26/projects/fv/html/vendor/magento/framework/Interception/Interceptor.php(138):
Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor),
Array, 'front-controlle...')
#8 /home/ar26/projects/fv/html/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(73):
Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#9 /home/ar26/projects/fv/html/vendor/magento/framework/Interception/Interceptor.php(142): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor),
Object(Closure), Object(Magento\Framework\App\Request\Http))
#10 /home/ar26/projects/fv/html/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26):
Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#11 /home/ar26/projects/fv/html/vendor/magento/framework/App/Http.php(135):
Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#12 /home/ar26/projects/fv/html/vendor/magento/framework/App/Bootstrap.php(258):
Magento\Framework\App\Http->launch()
#13 /home/ar26/projects/fv/html/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
Magento管理员:
1 exception(s): Exception
#0 (UnexpectedValueException): Setup version for module 'MSP_AdminRestriction' is not specified
Exception #0 (UnexpectedValueException): Setup version for module 'MSP_AdminRestriction' is not specified
#0 /home/ar26/projects/fv/html/vendor/magento/framework/Module/DbVersionInfo.php(56):
Magento\Framework\Module\DbVersionInfo->isModuleVersionEqual('MSP_AdminRestri...', '0.1.3')
#1 /home/ar26/projects/fv/html/vendor/magento/framework/Module/DbVersionInfo.php(79):
Magento\Framework\Module\DbVersionInfo->isSchemaUpToDate('MSP_AdminRestri...')
#2 /home/ar26/projects/fv/html/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(55):
Magento\Framework\Module\DbVersionInfo->getDbVersionErrors()
#3 /home/ar26/projects/fv/html/vendor/magento/framework/Interception/Interceptor.php(142):
Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor),
Object(Closure), Object(Magento\Framework\App\Request\Http))
#4 /home/ar26/projects/fv/html/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26):
Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#5 /home/ar26/projects/fv/html/vendor/magento/framework/App/Http.php(135):
Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#6 /home/ar26/projects/fv/html/vendor/magento/framework/App/Bootstrap.php(258):
Magento\Framework\App\Http->launch()
#7 /home/ar26/projects/fv/html/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#8 {main}
答案 0 :(得分:2)
为此 Magento 打开数据库并搜索表格
setup_module
在此表中,删除follwoig模块 MSP_AdminRestriction ,然后运行以下命令。
php bin / magetno setup:upgrade
php bin / magetno setup:static-content:deploy -f
答案 1 :(得分:1)
您将需要创建一个registration.php文件来注册您的模块。
在app / code / MSP / AdminRestriction / registration.php中。
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'MSP_AdminRestriction',
__DIR__
);
然后在公共区域下方射击
php bin/magento module:enable MSP_AdminRestriction
php -f bin/magento setup:upgrade
答案 2 :(得分:0)
我希望您已在模块文件夹中添加了/app/code/Namespace/Module/registration.php
和/app/code/Namespace/Module/composer.json
个文件。
所以在你的情况下,可能是文件/文件夹权限是一个错误,可以通过更改模块文件夹的权限来解决
chmod 775 <module path> -R
最后,运行这些命令以启用模块和升级设置(不要忘记将Module_Name
替换为您的模块)
php -f bin/magento module:enable --clear-static-content Module_Name
bin/magento setup:upgrade
另一种解决方案
如果app/etc/config.php
中未指定MSP_AdminRestriction
,则可以直接在config.php
指定您的模块名称,然后添加以下行
'MSP_AdminRestriction' => 1,
并运行命令
bin/magento setup:upgrade
希望这有帮助!
答案 3 :(得分:0)
请逐个执行此命令,
php bin/magetno setup:upgrade
如果Magento版本&gt; 2.2
php bin/magetno setup:static-content:deploy -f
如果Magento版本&lt; 2.2
php bin/magetno setup:static-content:deploy
答案 4 :(得分:0)
在m2数据库中查找表“setup_module”,删除记录模块='MSP_AdminRestriction' 然后,运行: php bin / magetno setup:upgrade
答案 5 :(得分:0)
也许你错过了这个模块的一些文件。
从git https://github.com/magespecialist/m2-MSP_AdminRestriction?files=1
复制它们然后运行
bin/magento module:enable m2-MSP_AdminRestriction
bin/magento setup:upgrade
如果它还没有处于开发模式,也可以
bin/magento setup:di:compile
答案 6 :(得分:0)
如果您尝试使用相同的根目录名称进行失败,则有可能。 您可以尝试使用其他根目录名称尝试此操作,也可以刷新浏览器缓存并重试。
我面临类似的问题,可以通过执行上述步骤来解决。
答案 7 :(得分:0)
检查MSP_AdminRestriction Extension文件的module.xml文件中的setup_version节点,是否正确定义。
这是扩展Flat_Toy的module.xml文件的示例
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" `xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">`
<module name="Flat_Toy" setup_version="1.0.0"/>
</config>
验证后,运行命令:
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento s:s:d -f