【发布时间】:2017-03-10 14:57:09
【问题描述】:
我在使用 ng build 构建 Angular2-cli 项目时遇到以下错误。当我运行 ng serve 时,项目运行良好。
ERROR in main.33b89c04bc9dfd9d2b66.bundle.js from UglifyJs
SyntaxError: Unexpected token: name (PubNubAngular)
我观察到在 package.json 中添加 PubNub Angular2 时出现错误。
"pubnub": "4.4.4",
"pubnub-angular2": "1.0.0"
tsconfig.json:
{
"compilerOptions": {
"baseUrl": "",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
]
}
}
Angular-cli 版本:1.0.0-beta.20-4
@angular/core 版本:2.1.0
有人可以帮我解决这个问题吗?
【问题讨论】:
-
请注意,您正在运行 非常 旧的、已弃用的“angular2”,它当前的版本为
2.4.9,名为@angular/core。您应该考虑升级。 -
就在前面的评论中,您几乎不可能找到对该版本的支持,并且从那时起对框架的更改是广泛而巨大的。
-
对不起,那个是 angular-cli 版本。更新了版本
标签: javascript angularjs angular webpack babeljs