【发布时间】:2017-01-11 22:10:47
【问题描述】:
这两天让我头疼。我最近将我的 laravel 应用程序更新到 5.3,在我拉入 Laravel/passport 的本地环境中。安装后,一切正常。
当我将此更新推送到生产服务器时,一切仍然正常,但 vue 在护照组件上抛出错误。我对 vue 还是很陌生,找不到是什么原因造成的。
我尝试的最后一件事是在生产服务器上重新安装 Laravel 和护照,这会导致相同的错误。当我将此安装推送到本地计算机时,一切正常。我猜这是某种依赖错误。
这些是错误:
[Vue warn]: Error when evaluating expression "token.scopes.length > 0": TypeError: Cannot read property 'length' of undefined (found in component: <passport-authorized-clients>)
[Vue warn]: Error when evaluating expression "token.client.name": TypeError: Cannot read property 'name' of undefined (found in component: <passport-authorized-clients>)
[Vue warn]: Error when evaluating expression "token.scopes.length > 0": TypeError: Cannot read property 'length' of undefined (found in component: <passport-authorized-clients>)
[Vue warn]: Error when evaluating expression "token.client.name": TypeError: Cannot read property 'name' of undefined (found in component: <passport-authorized-clients>)
有没有人遇到过同样的错误,我该如何解决?
编辑:我设法解决了这个问题。我将 php5.6 更新为 php7 并安装了以下 PHP 模块; libgmp-dev,php-gmp。当我再次进行全新安装时,npm 抱怨护照需要两个依赖项; mdanter/ecc 和 indigophp/hash-compat
【问题讨论】:
-
这里需要更多代码,但似乎您正在尝试绑定一些不存在的值(至少在
init上)。您是否将令牌创建为空对象,然后再往下添加属性?您是否有任何元素试图在创建时访问此属性? -
我刚刚想通了。 OAuth 服务器缺少一个 PHP 模块才能工作,我不知道为什么
composer require laravel/passport没有给我任何错误。但是在我安装 PHP 模块之后,节点给了我另一个错误,它需要mdanter/ecc and indigophp/hash-compat才能正常工作。 -
在我看来,这似乎是一个客户端问题vuejs/vue-resource#317
标签: vue.js laravel-5.3 laravel-passport