Empress - run error

Hi, I try to run fresh empress (http://localhost:4200/) but I got error

      this.forEach(item => ret.push(item[methodName]?.(...args)));

SyntaxError: Unexpected token '.'
    at new Script (vm.js:88:7)
    at VMSandbox.eval (/home/user/projects/super-blog/node_modules/fastboot/src/vm-sandbox.js:13:22)
    at /home/user/projects/super-blog/node_modules/fastboot/src/ember-app.js:190:15
    at Array.forEach (<anonymous>)
    at EmberApp.loadAppFiles (/home/user/projects/super-blog/node_modules/fastboot/src/ember-app.js:187:21)
    at EmberApp.retrieveSandboxedApp (/home/user/projects/super-blog/node_modules/fastboot/src/ember-app.js:235:10)
    at new EmberApp (/home/user/projects/super-blog/node_modules/fastboot/src/ember-app.js:61:21)
    at FastBoot._buildEmberApp (/home/user/projects/super-blog/node_modules/fastboot/src/index.js:114:17)
    at new FastBoot (/home/user/projects/super-blog/node_modules/fastboot/src/index.js:52:10)
    at /home/user/projects/super-blog/node_modules/ember-cli-fastboot/index.js:335:29

I try with two computers with configuration

ember-cli: 3.24.0 node: 12.19.0 os: linux x64


ember-cli: 3.22.0 node: 10.23.1 os: linux x64

I use documentation from https://github.com/empress/empress-blog/blob/master/README.md#quick-start

Thanks for help :slight_smile:

It looks like it doesn’t like the optional chaining ?. operator which is being used somewhere. Someone else reported this issue recently and it sounds like it’s caused by some intercompatibility problems.

Sounds like the solutions for the OP was using node 14. There are other options you could try as well though. It sounds like adding IE 11 to your targets may work. You could also use the babel plugin for optional chaining (see this comment for an example)

1 Like

The fix here is to ensure that you specify node: 'current' in your targets.js file.

The resulting file would look like:

module.exports = {
  node: 'current',
  browsers: [
    'last 2 Chrome versions',
    'last 2 Edge versions',
    'last 2 Firefox versions',
    'last 2 Opera versions',
    'last 2 Safari versions'

This instructs @babel/preset-env to consider your current node version as well as the list of supported browser targets when deciding what to transpile.

Note: In order to support the node property there, you need to ensure you have browserslist@4.0.0 or higher in any dependency that will be using nullish coalescing.

Some resources:


Thanks folks for help. Both solutions work :smiley: