2016-09-04 3 views
0

지난 2 일 동안 두통이 듭니다. 최근에 내 laravel 응용 프로그램을 5.3로 업데이트했습니다. 내 지역 환경에서 Laravel/passport를 가져 왔습니다. 설치 후에 모든 것이 예상대로 작동합니다.Laravel 5.3 Passport - Vue 오류 : 표현식을 평가할 때 오류가 발생했습니다.

이 업데이트를 프로덕션 서버에 푸시해도 모든 기능은 작동하지만 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

+0

는 여기에 몇 가지 더 많은 코드가 필요하지만 보인다 그것은 resources/assets/js/bootstrap.js에 다음을 추가하는 것이 좋습니다. 토큰을 빈 객체로 만든 다음 추가로 아래에 속성을 추가합니까? 생성시이 속성에 액세스하려고하는 요소가 있습니까? –

+0

방금 ​​알아 냈습니다. OAuth 서버가 작동하지 않는 PHP 모듈이 있는데, 왜 '작곡가가 laravel/passport가 필요합니다'가 나에게 어떤 오류도 던지지 않은 이유를 모르겠습니다. 하지만 PHP 모듈을 설치 한 후에 node는'mdanter/ecc와 indigophp/hash-compat'이 올바르게 작동하는 데 필요한 또 다른 오류를 보냈습니다. –

+0

내가보기에 클라이언트 문제로 보였다. [vuejs/vue-resource # 317] (https://github.com/vuejs/vue-resource/issues/317) –

답변

1

동일한 문제가있었습니다. 해결책은 here 나를 도왔습니다. 당신이 거기에없는 몇 가지 값을 결합하려고하는 것처럼 (init``에 적어도)

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); 
      } 
     } 
    }); 
});