npm run dev throws error [closed]

0

After configuring my app.js file in resources / assets /, when I run on the console npm run dev sends me this error:

ERROR in ./resources/assets/js/app.js
Module build failed: SyntaxError: C:/xampp/htdocs/logismart/resources         
/assets/js/app.js: Unexpected token, expected , (30:15)

 28 |
 29 |     data: {
> 30 |          vehiculos []
    |                    ^
 31 |     },
 32 |     methods: {
 33 |          getvehiculos function() {

 @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss
 npm ERR! code ELIFECYCLE
 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.

My app.js file is as follows     require ('./ bootstrap');

window.Vue = require('vue'); 

const app = new Vue({

el: '#crud',         

created: function(){
    this.getvehiculos();
},

data: {
    vehiculos []
},
methods: {
    getvehiculos function() {

        var urlprueba = 'choferes';
        axios.get(urlprueba).then(response =>{
        this.vehiculos = response.data
        }) 
    }
},


});
    
asked by FGB 24.04.2018 в 20:33
source

1 answer

1

You are missing the colon to declare the property as an array in your data as follows:

window.Vue = require('vue'); 

const app = new Vue({

el: '#crud',         

created: function(){
    this.getvehiculos();
},

data: {
    vehiculos: []
},
methods: {
    getvehiculos function() {

        var urlprueba = 'choferes';
        axios.get(urlprueba).then(response =>{
        this.vehiculos = response.data
        }) 
    }
},


});
    
answered by 24.04.2018 / 20:36
source