Tag Archives: Parsing error

Vue の NPM run serve error: parsing error: unexpected token<

error: Parsing error: Unexpected token <  

Although this error occurred, it did not affect the operation of the project.
Solution:
Run installation dependency

npm install --save-dev babel-plugin-transform-object-rest-spread

Then create the.babelrc.js file in the project directory and add the following code

babel: {
    presets: [
        'es2015'
    ]
    Plugins: [
        'transform-object-rest-spread'
    ]
}

Rerun, error is gone.

Follow-up update solutions:
If the above methods will also appear error Parsing error: Unexpected Token, add the following code
Start with the installation dependencies

npm install babel-eslint --save

Then add code parsing to.eslintrc.js

"parser": "babel-eslint" 

Restart it.