这两天让我头疼。我最近将我的laravel应用程序更新到5.3,在我的本地环境中,我拉入了Laravel/passport。安装完成后,一切都会按预期运行。
当我将此更新推送到生产服务器时,一切仍然正常,但vue在passport组件上抛出错误。我仍然是vue的新手,我找不到是什么导致了这种情况。
我尝试的最后一件事是在生产服务器上重新安装Laravel和passport,这导致了相同的错误。当我将此安装推送到本地计算机时,一切都正常。我猜这是某种依赖错误。
以下是错误:
[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抱怨passport需要两个依赖项: mdanter/ecc和indigophp/hash-compat
发布于 2016-09-23 17:59:58
我也遇到过同样的问题。here的解决方案帮助了我。它建议在resources/assets/js/bootstrap.js中添加以下内容
Vue.http.interceptors.push((request, next ) => {
next((response) => {
if( 'Content-Type' in response.headers
&& response.headers['Content-Type'] == 'application/json' ){
if( typeof response.data != 'object' ){
response.data = JSON.parse( response.data );
}
}
if( 'content-type' in response.headers
&& response.headers['content-type'] == 'application/json' ){
if( typeof response.data != 'object' ){
response.data = JSON.parse( response.data );
}
}
});
});https://stackoverflow.com/questions/39315341
复制相似问题