angular2 AOT总是失败:这个package.json有什么问题吗?
有人能给我一个工作包.json让angular2 AOT编译通过吗? 我的包裹如下:angular2 AOT总是失败:这个package.json有什么问题吗?,angular,angular2-aot,Angular,Angular2 Aot,有人能给我一个工作包.json让angular2 AOT编译通过吗? 我的包裹如下: "dependencies": { "@angular/common": "2.3.0", "@angular/compiler": "2.3.0", "@angular/compiler-cli": "2.3.0", "@angular/core": "2.3.0", "@angular/forms": "~2.1.1", "@angular/http": "~
"dependencies": {
"@angular/common": "2.3.0",
"@angular/compiler": "2.3.0",
"@angular/compiler-cli": "2.3.0",
"@angular/core": "2.3.0",
"@angular/forms": "~2.1.1",
"@angular/http": "~2.1.1",
"@angular/platform-browser": "2.3.0",
"@angular/platform-browser-dynamic": "2.3.0",
"@angular/platform-server": "2.2.3",
"@angular/router": "~3.1.1",
"core-js": "^2.4.1",
"rxjs": "5.0.0-beta.12",
"socket.io": "^1.7.2",
"zone.js": "^0.6.25",
"typescript": "2.0.10",
},
在我删除所有node_模块并重新安装npm之后,我运行:
node_modules/.bin/ngc -p tsconfig-aot.json
我犯了很多错误
Error at angular2/ng2_webpack_aot/node_modules/typescript/lib/lib.es2015.core.d.ts:17:14: Duplicate identifier 'PropertyKey'.
Error at angular2/ng2_webpack_aot/node_modules/@types/core-js/index.d.ts:21:14: Duplicate identifier 'PropertyKey'.
Error at angular2/ng2_webpack_aot/node_modules/@types/core-js/index.d.ts:85:5: All declarations of 'name' must have identical modifiers.
Error at angular2/ng2_webpack_aot/node_modules/@types/core-js/index.d.ts:145:5: Subsequent variable declarations must have the same type. Varia
.....
有人能和我分享你的package.json配置吗?你能成功编译AOT吗
我的tsconfig-aot.json如下所示:
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"lib": ["es2015", "dom"],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
"files": [
"src/app/app.module.ts",
"src/main.ts"
],
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit" : true
}
}
降级typescript的版本。卸载typescript版本2.0.10并安装版本2.0.3。这是因为
核心js的键入和typescriptes2015
lib重叠,当您遇到此错误时,尝试使用libes5
而不是es2015?运行时间?Npm安装?N开始?显示您的tsconfig?我在运行命令节点_modules/.bin/ngc-p tsconfig-aot.json时出错。不幸的是,typescript 2.0.3也有相同的错误。这就是诀窍,为什么angular网站提供了错误的信息?希望他们能改变