2017-02-27 49 views
1

我不断收到试图部署laravel应用到生产服务器时,此错误:Laravel InvalidArgumentException在RouteRegistrar.php线75:

InvalidArgumentException in RouteRegistrar.php line 75:

in RouteRegistrar.php line 75 
at RouteRegistrar->attribute('after', object(AfterFilter)) in Router.php line 1085 
at Router->__call('after', array(object(AfterFilter))) in BootProviders.php line 17 
at Router->after(object(AfterFilter)) in BootProviders.php line 17 
at Application->boot() in BootProviders.php line 17 
at BootProviders->bootstrap(object(Application)) in Application.php line 208 
at Application->bootstrapWith(array('Illuminate\\Foundation\\Bootstrap\\LoadEnvironmentVariables', 'Illuminate\\Foundation\\Bootstrap\\LoadConfiguration', 'Illuminate\\Foundation\\Bootstrap\\HandleExceptions', 'Illuminate\\Foundation\\Bootstrap\\RegisterFacades', 'Illuminate\\Foundation\\Bootstrap\\RegisterProviders', 'Illuminate\\Foundation\\Bootstrap\\BootProviders')) in Kernel.php line 160 
at Kernel->bootstrap() in Kernel.php line 144 
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116 
at Kernel->handle(object(Request)) in index.php line 54 

奇怪的是,我不明白这个错误在我的本地机器上。我的机器和生产服务器的PHP版本几乎完全相同(服务器上的5.6.25和机器上的5.6.26)。

有没有人有任何想法可能会导致此错误?

+0

您使用的是哪个版本的Laravel?你有一个有效的.env文件吗?您的部署步骤是什么? – PeterPan666

+0

Laravel v5.4 .env文件存在且有效。 该代码是从git存储库克隆的,然后执行“composer install”。当它尝试运行“php artisan optimize”时发生该错误。但是我也在页面上看到错误。 – Lloyd

+0

您是在部署时还是在尝试访问您的网站? – PeterPan666

回答

1

这个异常应该会抛出类似Attribute [{$key}] does not exist.的消息,您需要找到该密钥并进行修复。看来你没有使用正确的密钥名称,你可以找到允许的密码here

protected $allowedAttributes = [ 
    'as', 'domain', 'middleware', 'name', 'namespace', 'prefix', 
]; 

抛出该异常是在RouteRegistrar.php文件attribute的方法。

+0

是的,它确实会抛出这条消息:“属性[之后]不存在。”但问题是,这不是我的代码产生这个问题。我也用一个股票laravel 5.4安装来解决这个问题。 – Lloyd

+0

您是否在Laravel应用程序中使用任何其他软件包? – PeterPan666

+0

在完整的应用程序中,我使用其他软件包是。这就是为什么我使用Laravel的股票安装来测试它是否是我的软件包引起的问题。 我已经尝试将它安装在具有类似设置但php版本较高的服务器上(5.6.28)。并在该服务器上工作。 – Lloyd

相关问题