Npx frontity dev Unexpected token error

Thanks for looking.

I have tried with the mars and the 2020 theme with no luck getting this to work.

When I run the command npx frontity dev I get this set of errors:

SERVER STARTED -- Listening @ http://localhost:3000
  - mode: development
  - target: module
  - public-path: /static/



Error: ./node_modules/@frontity/core/src/utils/merge-packages.ts
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/shehan/code/rockrose/node_modules/@frontity/core/src/utils/merge-packages.ts: Unexpected token (17:18)

  15 |   packages,
  16 |   state,
> 17 |   overwriteArrays = false,
     |                   ^
  18 | }: {
  19 |   packages: {
  20 |     [name: string]: Package | PackageFunction;
    at Object._raise (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:60:45)
    at Object.raiseWithData (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:55:17)
    at Object.raise (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:39:17)
    at Object.unexpected (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/util.js:139:16)
    at Object.checkExpressionErrors (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/util.js:241:12)
    at Object.parseParenAndDistinguishExpression (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:1484:10)
    at Object.parseExprAtom (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:1071:21)
    at Object.parseExprSubscripts (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:563:23)
    at Object.parseUpdate (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:543:21)
    at Object.parseMaybeUnary (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:527:17)
 @ ./node_modules/@frontity/core/src/client/store.ts 1:43-94 1:187-200
 @ ./node_modules/@frontity/core/src/client/index.tsx
 @ ./build/bundling/entry-points/rockrose/client.ts
 @ multi webpack-hot-middleware/client ./build/bundling/entry-points/rockrose/client.ts

./node_modules/@frontity/html2react/src/libraries/component.tsx
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/shehan/code/rockrose/node_modules/@frontity/html2react/src/libraries/component.tsx: Unexpected token, expected ";" (63:25)

  61 |   processors,
  62 |   ...payload
> 63 | }: ApplyProcessorsParams): boolean => {
     |                          ^
  64 |   for (const proc of processors) {
  65 |     // Add deprecation warning for process.
  66 |     if ((proc as any).process)
    at Object._raise (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:60:45)
    at Object.raiseWithData (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:55:17)
    at Object.raise (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:39:17)
    at Object.unexpected (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/util.js:139:16)
    at Object.semicolon (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/util.js:109:40)
    at Object.parseVarStatement (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:697:10)
    at Object.parseStatementContent (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:213:21)
    at Object.parseStatementContent (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/plugins/typescript/index.js:2095:20)
    at Object.parseStatement (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:153:17)
    at Object.parseBlockOrModuleBlockBody (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:873:25)
 @ ./node_modules/@frontity/html2react/src/index.ts 1:0-45 1:173-182
 @ ./build/bundling/entry-points/rockrose/client.ts
 @ multi webpack-hot-middleware/client ./build/bundling/entry-points/rockrose/client.ts

./node_modules/@frontity/wp-source/src/libraries/handlers/postTypeArchive.ts
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/shehan/code/rockrose/node_modules/@frontity/wp-source/src/libraries/handlers/postTypeArchive.ts: Unexpected token, expected ";" (15:2)

  13 |   type: string;
  14 |   endpoint: string;
> 15 | }): Handler => async ({
     |   ^
  16 |   link: linkArg,
  17 |   route: routeArg,
  18 |   state,
    at Object._raise (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:60:45)
    at Object.raiseWithData (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:55:17)
    at Object.raise (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:39:17)
    at Object.unexpected (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/util.js:139:16)
    at Object.semicolon (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/util.js:109:40)
    at Object.parseVarStatement (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:697:10)
    at Object.parseStatementContent (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:213:21)
    at Object.parseStatementContent (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/plugins/typescript/index.js:2095:20)
    at Object.parseStatement (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:153:17)
    at Object.parseBlockOrModuleBlockBody (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:873:25)
 @ ./node_modules/@frontity/wp-source/src/libraries/handlers/index.ts 1:134-188 4:23-45 6:0-88
 @ ./node_modules/@frontity/wp-source/src/actions.ts
 @ ./node_modules/@frontity/wp-source/src/index.ts
 @ ./build/bundling/entry-points/rockrose/client.ts
 @ multi webpack-hot-middleware/client ./build/bundling/entry-points/rockrose/client.ts

./node_modules/@frontity/wp-source/src/libraries/handlers/postTypeWithQuery.ts
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/shehan/code/rockrose/node_modules/@frontity/wp-source/src/libraries/handlers/postTypeWithQuery.ts: Unexpected token (71:14)

  69 |   type,
  70 |   endpoint,
> 71 |   idParamName = "p",
     |               ^
  72 | }: PostTypeWithQueryHandlerOptions): Handler => async ({
  73 |   link,
  74 |   state,
    at Object._raise (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:60:45)
    at Object.raiseWithData (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:55:17)
    at Object.raise (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:39:17)
    at Object.unexpected (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/util.js:139:16)
    at Object.checkExpressionErrors (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/util.js:241:12)
    at Object.parseParenAndDistinguishExpression (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:1484:10)
    at Object.parseExprAtom (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:1071:21)
    at Object.parseExprSubscripts (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:563:23)
    at Object.parseUpdate (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:543:21)
    at Object.parseMaybeUnary (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:527:17)
 @ ./node_modules/@frontity/wp-source/src/libraries/handlers/index.ts 1:188-246 2:271-295 2:353-377 6:0-88
 @ ./node_modules/@frontity/wp-source/src/actions.ts
 @ ./node_modules/@frontity/wp-source/src/index.ts
 @ ./build/bundling/entry-points/rockrose/client.ts
 @ multi webpack-hot-middleware/client ./build/bundling/entry-points/rockrose/client.ts

./node_modules/@frontity/wp-source/src/libraries/handlers/taxonomy.ts
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/shehan/code/rockrose/node_modules/@frontity/wp-source/src/libraries/handlers/taxonomy.ts: Unexpected token, expected ";" (70:25)

  68 |   postTypeEndpoint,
  69 |   params: handlerParams = {},
> 70 | }: TaxonomyHandlerParams): Handler => async ({
     |                          ^
  71 |   link: linkArg,
  72 |   route: routeArg,
  73 |   params,
    at Object._raise (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:60:45)
    at Object.raiseWithData (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:55:17)
    at Object.raise (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:39:17)
    at Object.unexpected (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/util.js:139:16)
    at Object.semicolon (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/util.js:109:40)
    at Object.parseVarStatement (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:697:10)
    at Object.parseStatementContent (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:213:21)
    at Object.parseStatementContent (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/plugins/typescript/index.js:2095:20)
    at Object.parseStatement (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:153:17)
    at Object.parseBlockOrModuleBlockBody (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:873:25)
 @ ./node_modules/@frontity/wp-source/src/libraries/handlers/index.ts 1:54-94 3:15-30 3:85-100 6:0-88
 @ ./node_modules/@frontity/wp-source/src/actions.ts
 @ ./node_modules/@frontity/wp-source/src/index.ts
 @ ./build/bundling/entry-points/rockrose/client.ts
 @ multi webpack-hot-middleware/client ./build/bundling/entry-points/rockrose/client.ts

./node_modules/@frontity/wp-source/src/libraries/populate.ts
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/shehan/code/rockrose/node_modules/@frontity/wp-source/src/libraries/populate.ts: Unexpected token, expected ";" (43:23)

  41 |   state,
  42 |   ...options
> 43 | }: TransformLinkParams): void => {
     |                        ^
  44 |   let { subdirectory } = state.source;
  45 |   if (options.subdirectory) subdirectory = options.subdirectory;
  46 | 
    at Object._raise (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:60:45)
    at Object.raiseWithData (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:55:17)
    at Object.raise (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:39:17)
    at Object.unexpected (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/util.js:139:16)
    at Object.semicolon (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/util.js:109:40)
    at Object.parseVarStatement (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:697:10)
    at Object.parseStatementContent (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:213:21)
    at Object.parseStatementContent (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/plugins/typescript/index.js:2095:20)
    at Object.parseStatement (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:153:17)
    at Object.parseBlockOrModuleBlockBody (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/statement.js:873:25)
 @ ./node_modules/@frontity/wp-source/src/libraries/index.ts 1:34-78 1:174-220
 @ ./node_modules/@frontity/wp-source/src/index.ts
 @ ./build/bundling/entry-points/rockrose/client.ts
 @ multi webpack-hot-middleware/client ./build/bundling/entry-points/rockrose/client.ts

./node_modules/@frontity/wp-source/src/libraries/route-utils.ts
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/shehan/code/rockrose/node_modules/@frontity/wp-source/src/libraries/route-utils.ts: Unexpected token (134:7)

  132 |  */
  133 | const paramsToLink = ({
> 134 |   path = "/",
      |        ^
  135 |   route,
  136 |   page = 1,
  137 |   query = {},
    at Object._raise (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:60:45)
    at Object.raiseWithData (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:55:17)
    at Object.raise (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/error.js:39:17)
    at Object.unexpected (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/util.js:139:16)
    at Object.checkExpressionErrors (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/util.js:241:12)
    at Object.parseParenAndDistinguishExpression (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:1484:10)
    at Object.parseExprAtom (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:1071:21)
    at Object.parseExprSubscripts (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:563:23)
    at Object.parseUpdate (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:543:21)
    at Object.parseMaybeUnary (/Users/shehan/code/rockrose/node_modules/@babel/parser/src/parser/expression.js:527:17)
 @ ./node_modules/@frontity/wp-source/src/state.ts 1:0-53 1:126-135 1:229-234 1:253-262
 @ ./node_modules/@frontity/wp-source/src/index.ts
 @ ./build/bundling/entry-points/rockrose/client.ts
 @ multi webpack-hot-middleware/client ./build/bundling/entry-points/rockrose/client.ts

If you need help please visit https://community.frontity.org/.

When I run npx frontity info

## System:
 - OS: macOS High Sierra 10.13.6
 - CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
 - Memory: 23.70 MB / 8.00 GB
 - Shell: 3.2.57 - /bin/bash
## Binaries:
 - Node: 12.19.0 - /usr/local/bin/node
 - npm: 6.14.8 - /usr/local/bin/npm
## Browsers:
 - Chrome: 86.0.4240.80
 - Edge: Not Found
 - Firefox: 79.0
 - Safari: 13.1.1
## npmPackages:
 - @frontity/core: ^1.9.0 => 1.9.0 
 - @frontity/html2react: ^1.4.0 => 1.4.0 
 - @frontity/tiny-router: ^1.2.2 => 1.2.2 
 - @frontity/twentytwenty-theme: ./packages/twentytwenty-theme => 1.2.1 
 - @frontity/wp-source: ^1.9.1 => 1.9.1 
 - frontity: ^1.12.0 => 1.12.0 
## npmGlobalPackages:
 - frontity: Not Found
 - npx: Not Found

Thanks for your help

Hi @shehan11 :wave: !

I believe the error you’re seeing was caused by a bug in @babel/parser: https://github.com/babel/babel/issues/12195.

It has now been fixed by the babel maintainers so please remove your node_modules, yarn / npm install and run your project again!

If you still have any issues do let us know!

That was it, Thank you Michal!