visual studio - Angular2 - los archivos ngfactory no se generan para la compilación previa al tiempo de ejecución
Estoy intentando hacer que Angular2 AoT funcione. Desafortunadamente, los archivos .ngfactory no se generan cuando ejecuto el comando ngc:
./node_modules/.bin/ngc" -p "./tsconfig-aot.json" --i18nFile="./app/compiled/localise.xlf" --locale=zh --i18nFormat=xlf
Con esa configuración, mi compilación 'JIT' funciona bien, hasta que se ejecuta el comando ngc, entonces también rompe JIT hasta que se reconstruye la solución.
Error que da:
(SystemJS) XHR error (404) loading https:// <domain>/<urlPath>/traceur
Error: XHR error (404) loading https:// <domain>/<urlPath>/traceur
at XMLHttpRequest.wrapFn [as _onreadystatechange] (https://<domain>/node_modules/zone.js/dist/zone.js:889:29) [<root>]
at Zone.runTask (https:// <domain>/node_modules/zone.js/dist/zone.js:151:47) [<root> => <root>]
at XMLHttpRequest.ZoneTask.invoke (https:// <domain>/node_modules/zone.js/dist/zone.js:345:33) [<root>]
Error loading https:// <domain>/<urlPath>/traceur
Unable to load transpiler to transpile https:// <domain>/<pathToMain>/main.js
Error loading https://<domain>/<pathToMain>/main.js
Mi configuración:
package.json:
{
"version": "1.0.0",
"name": "aspnet",
"private": true,
"scripts": {
"postinstall": "typings install",
"typings": "typings"
},
"dependencies": {
"@angular/common": "2.4.1",
"@angular/compiler": "2.4.1",
"@angular/compiler-cli": "2.4.1",
"@angular/core": "2.4.1",
"@angular/forms": "2.4.1",
"@angular/http": "2.4.1",
"@angular/platform-browser": "2.4.1",
"@angular/platform-browser-dynamic": "2.4.1",
"@angular/platform-server": "2.4.1",
"@angular/upgrade": "2.4.1",
"@types/node": "6.0.57",
"angular-in-memory-web-api": "0.2.4",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.2",
"systemjs": "0.19.41",
"zone.js": "^0.7.2"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-concat": "^2.6.0",
"gulp-tsc": "^1.2.0",
"gulp-typescript": "3.1.3",
"path": "^0.12.7",
"rollup": "0.40.2",
"rollup-plugin-commonjs": "7.0.0",
"rollup-plugin-multi-entry": "^2.0.1",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-uglify": "^1.0.1",
"typescript": "^2.0.2",
"typings": "2.1.0"
}
}
tsconfig-aot.json:
{
"compileOnSave": true,
"compilerOptions": {
"module": "es2015",
"noEmitOnError": true,
"noImplicitAny": false,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"typeRoots": [
"node_modules/@types"
]
},
"include": [
"app/**/*.ts"
],
"exclude": [
"node_modules",
"typings/index",
"typings/index.d.ts"
],
"angularCompilerOptions": {
"genDir": "app/compiled",
"skipMetadataEmit": true
}
}
tsconfig.json:
{
"compileOnSave": true,
"compilerOptions": {
"module": "commonjs",
"noEmitOnError": true,
"noImplicitAny": false,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"typeRoots": [
"node_modules/@types"
]
},
"include": [
"app/**/app.module.ts",
"app/**/*.ts"
],
"exclude": [
"node_modules",
"typings/index",
"typings/index.d.ts"
],
"angularCompilerOptions": {
"genDir": "app/compiled",
"skipMetadataEmit": true
}
}
Y el TypeScript en la versión 2.0.2.
Angular y todos los paquetes se han actualizado a las últimas versiones, pero no ayudó.
Se ha ejecutado npm install y se ha generado node_modules.
Se ha llamado a gulp y también se ha creado el directorio libs.
Cualquier ayuda sería apreciada.
Respuesta #1
Podría no ser 2.0.2 ya que tienes una ^(^) en tu package.json.
Elimina el acento circunflejo (^), elimina la librería, instala la dependencia y vuelve a intentarlo.
Así: "typescript": "2.0.2"