2017-07-11 8 views
0

私はvue.jsでLaravel 5.4を使用しています。それから私は作成されたメソッドとの間に構文エラーがありました。私は忘れた、私はこのエラーを修正します。npmキャッシングの問題 - 再構築しなかった

でも、エラーは継続します。

<script> 
export default { 

    data(){ 
     return { 
      users: [] 
     } 

    }, 

    created(){ 
     this.fetchUsers(); 
    },//forgotten 

    methods:{ //41.line 
     fetchUsers(){ 
     this.$http.get('/users').then(response => { 
      this.users = response.data.users; 
     }); 
     } 

    } 

} 
</script> 

私は「NPMの実行DEV」または「NPMの実行ウォッチ」を書く場合apache.Butはまだ、このエラーを持って再起動しました。

error in ./resources/assets/js/components/Users.vue 

    Syntax Error: Unexpected token, expected , (41:4) 
npm ERR! code ELIFECYCLE 
npm ERR! errno 2 
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js` 
npm ERR! Exit status 2 
npm ERR! 
npm ERR! Failed at the @ development script. 
npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 

npm ERR! A complete log of this run can be found in: 
npm ERR!  /home/ubuntu/.npm/_logs/2017-07-11T08_13_41_572Z-debug.log 
npm ERR! code ELIFECYCLE 
npm ERR! errno 2 
npm ERR! @ dev: `npm run development` 
npm ERR! Exit status 2 
npm ERR! 
npm ERR! Failed at the @ dev script. 
npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 

npm ERR! A complete log of this run can be found in: 
npm ERR!  /home/ubuntu/.npm/_logs/2017-07-11T08_13_41_618Z-debug.log 

EDIT

私はあなたのアドバイスやapplied.Iを聞き、問題が関連構文ではありません意味mistake.The問題は、古いコードで新しいcode.IのINSEADを実行して、すべてのファイルと、「NPMを保存dev "を実行しますが、毎回同じエラーが返されます。

+0

どのノードのバージョンを使用していますか? – mscdex

+0

あなたの完全なコンポーネントコードを表示する - それにもかかわらず、2つのecmascriptスタイルを混在させているようです –

+0

ノードバージョン8.1.3 @mscdex – more

答えて

0

でも、私はこの実行の同じerror- A完全なログがで見つけることができました。問題は、ポート番号である 、package.jsonファイルに移動し、あなたが欲しいものにポート番号を変更し、8000を言います。たとえば:

"scripts": { 
    "build": "webpack --config webpack.prod.js --progress", 
    "watch": "npm run build -- --watch", 
    "server": "webpack-dev-server --inline --progress --port 8000 --content-base src", 
    "start": "npm run server" 
    } 

以前のポート番号は3000だった、と私の新しいアプリケーションのためにそのポート3000にレンダリングするnpm start異なるアプリケーションの使用に私はポート番号8000を与えました。これで、別のポート(localhost:3000とlocalhost:8000)上で2つの異なるアプリケーションをエラーなく実行できます。

関連する問題