【发布时间】:2017-08-16 05:41:06
【问题描述】:
我正在关注Angular Tour of Heroes tutorial。
加载应用程序 localhost:3000 后,我立即在 Chrome 浏览器 (v47) 中收到以下错误。相同的应用程序在 Firefox (v45) 中不会产生错误:
SyntaxError:块范围的声明(let、const、函数、类) 在 eval (native) 处尚不支持外部严格模式 SystemJSLoader.__exec (http://localhost:3000/node_modules/systemjs/dist/system.src.js:1555:18) 在 entry.execute (http://localhost:3000/node_modules/systemjs/dist/system.src.js:4035:18) 在链接动态模块 (http://localhost:3000/node_modules/systemjs/dist/system.src.js:3300:32) 在链接 (http://localhost:3000/node_modules/systemjs/dist/system.src.js:3135:11) 在 Object.execute (http://localhost:3000/node_modules/systemjs/dist/system.src.js:3510:13) 在 doDynamicExecute (http://localhost:3000/node_modules/systemjs/dist/system.src.js:766:25) 在链接 (http://localhost:3000/node_modules/systemjs/dist/system.src.js:964:20) 在 doLink (http://localhost:3000/node_modules/systemjs/dist/system.src.js:623:7) 在 updateLinkSetOnLoad (http://localhost:3000/node_modules/systemjs/dist/system.src.js:669:18) 在 http://localhost:3000/node_modules/systemjs/dist/system.src.js:485:11 在 ZoneDelegate.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:334:26) 在 区域运行 (http://localhost:3000/node_modules/zone.js/dist/zone.js:126:43) 在 http://localhost:3000/node_modules/zone.js/dist/zone.js:713:57 在 ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:367:31)
这是正在使用的 tsconfig.json 文件(在教程中提供):
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
}
}
【问题讨论】:
标签: javascript google-chrome angular