任何人都可以給我一個工作package.json使angular2 AOT編譯通過? 我的包是如下:angular2 AOT總是失敗:這個package.json有什麼問題?
"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_modules和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
}
}
當u得到這個錯誤?運行? Npm安裝? N開始? – Aravind
顯示你的tsconfig? – vidalsasoon
當我運行命令node_modules/.bin/ngc -p tsconfig-aot.json – user3006967