I just started using vue js and I was following a tutorial. To get started I type in the command line the following:
vue init webpack test-app
I insert the project title, author, I don't install the lint and the test framework. I enter the project folder and run npm install and npm run dev but I get this error:
ERROR Failed to compile with 2 errors 4:58:04 PM
error in ./src/App.vue
Syntax Error: Unexpected token {
@ ./~/vue-style-loader!./~/css-loader?{"minimize":false,"sourceMap":false}!./~/vue-loader/lib/style-compiler?{"id":"data-v-17d125bb","scoped":false,"hasInlineConfig":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/App.vue 4:14-303 13:3-17:5 14:22-311
@ ./src/App.vue
@ ./src/main.js
@ multi ./build/dev-client ./src/main.js
error in ./src/components/Hello.vue
Syntax Error: Unexpected token {
@ ./~/vue-style-loader!./~/css-loader?{"minimize":false,"sourceMap":false}!./~/vue-loader/lib/style-compiler?{"id":"data-v-369af42f","scoped":true,"hasInlineConfig":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/components/Hello.vue 4:14-313 13:3-17:5 14:22-321
@ ./src/components/Hello.vue
@ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue
@ ./src/App.vue
@ ./src/main.js
@ multi ./build/dev-client ./src/main.js
> Listening at http://localhost:8080
And if I go to localhost:8080 I can only see:
Cannot GET /
What can be wrong in the code with a fresh intallation?
EDIT: this is App.vue file
<template>
<div id="app">
<img src="./assets/logo.png">
<hello></hello>
</div>
</template>
<script>
import Hello from './components/Hello'
export default {
name: 'app',
components: {
Hello
}
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
I just had the exact same problem! I solved it by updating Node.js to the latest version (7.7.4).