Hello, world - troubles on viewmodel

Hello everyone,
I’m trying to follow the Creating Your First App - The Aurelia Docs steps but I have some problems.
First, the page won’t start on “npm start”, I had to run
npm install --save-dev webpack
and some more till a “npm install” that allowed me to see the page.
Still, following the steps, after creating the “hello-name.js” and “hello-name.html” I got
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: C:\dev\projects\aurelia\hello-world\src\hello-name.js: Unexpected token (2:9)
export class HelloNameCustomElement {
public name = ‘Person’;

I’ll try it again from start with other options but I wanted to share this.
Thank you

1 Like

Something wrong with the doc. It should have a switch for JS or TS syntax.

The code you copied is in TypeScript, but you are using normal JavaScript.

Remove “public” (it’s a TypeScript keyword) from your code.

5 Likes

Thank you, so I’ll take the TypeScript way just to see things “up and running” before playing with code myself :slightly_smiling_face:

1 Like