1
votes

I am following the Angular Tour of Heroes tutorial.

I am receiving the following error immediately in Chrome browser (v47) upon loading the application localhost:3000. The same application does not produce an error in Firefox (v45):

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode at eval (native) at SystemJSLoader.__exec (http://localhost:3000/node_modules/systemjs/dist/system.src.js:1555:18) at entry.execute (http://localhost:3000/node_modules/systemjs/dist/system.src.js:4035:18) at linkDynamicModule (http://localhost:3000/node_modules/systemjs/dist/system.src.js:3300:32) at link (http://localhost:3000/node_modules/systemjs/dist/system.src.js:3135:11) at Object.execute (http://localhost:3000/node_modules/systemjs/dist/system.src.js:3510:13) at doDynamicExecute (http://localhost:3000/node_modules/systemjs/dist/system.src.js:766:25) at link (http://localhost:3000/node_modules/systemjs/dist/system.src.js:964:20) at doLink (http://localhost:3000/node_modules/systemjs/dist/system.src.js:623:7) at updateLinkSetOnLoad (http://localhost:3000/node_modules/systemjs/dist/system.src.js:669:18) at http://localhost:3000/node_modules/systemjs/dist/system.src.js:485:11 at ZoneDelegate.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:334:26) at Zone.run (http://localhost:3000/node_modules/zone.js/dist/zone.js:126:43) at http://localhost:3000/node_modules/zone.js/dist/zone.js:713:57 at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:367:31)

This is the tsconfig.json file being used (as supplied in the tutorial):

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [ "es2015", "dom" ],
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true
  }
}
1

1 Answers

0
votes

Try to add "alwaysStrict":true to your tsconfig. As it says in error you need to use strict mode and this option will do it for you.

'use strict';