更新TypeScript和NodeJ后Angular2-ngc停止生成.ngfactory文件

时间:2018-09-25 08:29:55

标签: angular angular2-aot

我对Angular2应用程序有疑问。以前使用的是typescript 2.0.6,所有代码都运行良好。

由于要升级到VS2017,我必须更新以下内容:

TypeScript to version 2.3.3

rxJS to latest version

add rxJs-compat软件包,以便JIT编译工作。

在我尝试编译AOT角度应用程序后,该更改未生成.ngfactory.ts文件,因此ngc命令失败。

在我的系统中,我已经安装:

npm version 6.4.1

node version 8.11.4

我的配置:

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/models/**/*.ts",
    "app/**/app.module.ts",
    "app/**/main-aot.ts"
  ],
  "exclude": [
    "node_modules",
    "typings/index",
    "typings/index.d.ts"
  ],
  "angularCompilerOptions": {
    "genDir": "app/compiled",
    "skipMetadataEmit": true
  }
}



packages.json:
{
  "version": "1.0.0",
  "name": "aspnet",
  "private": true,
  "scripts": {
    "postinstall": "typings install",
    "typings": "typings"
  },
  "dependencies": {
    "@angular/common": "2.1.0",
    "@angular/compiler": "2.1.0",
    "@angular/compiler-cli": "2.1.0",
    "@angular/core": "2.1.0",
    "@angular/forms": "2.1.0",
    "@angular/http": "2.1.0",
    "@angular/platform-browser": "2.1.0",
    "@angular/platform-browser-dynamic": "2.1.0",
    "@angular/platform-server": "2.1.0",
    "@angular/upgrade": "2.1.0",
    "@types/node": "0.0.0",
    "angular-in-memory-web-api": "0.1.5",
    "angular2-infinite-scroll": "0.2.9",
    "bootstrap": "3.3.7",
    "core-js": "2.4.1",
    "gulp": "^3.9.1",
    "jasmine-core": "~2.4.1",
    "karma": "^1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-teamcity-reporter": "^1.0.0",
    "reflect-metadata": "0.1.8",
    "rxjs": "6.1.0",
    "rxjs-compat": "^6.3.1",
    "systemjs": "0.19.39",
    "zone.js": "0.6.25"
  },
  "devDependencies": {
    "@types/jasmine": "2.5.41",
    "@types/node": "^6.0.46",
    "autoprefixer": "^6.7.7",
    "concurrently": "^3.1.0",
    "cssnano": "^3.10.0",
    "del": "2.2.2",
    "gulp-add-src": "^0.2.0",
    "gulp-autoprefixer": "^3.1.1",
    "gulp-cache": "0.4.6",
    "gulp-clean": "0.3.2",
    "gulp-cli": "1.2.2",
    "gulp-concat": "2.6.0",
    "gulp-environments": "^0.1.2",
    "gulp-gzip": "^1.4.0",
    "gulp-imagemin": "3.1.1",
    "gulp-jshint": "2.0.4",
    "gulp-order": "^1.1.1",
    "gulp-postcss": "^6.4.0",
    "gulp-rename": "^1.2.2",
    "gulp-rev": "^7.1.2",
    "gulp-rev-delete-original": "^0.2.3",
    "gulp-sass": "3.1.0",
    "gulp-sass-lint": "1.3.2",
    "gulp-sourcemaps": "^2.5.1",
    "gulp-tsc": "1.2.0",
    "gulp-typescript": "2.13.6",
    "gulp-uglify": "2.1.0",
    "jasmine-core": "~2.4.1",
    "jshint": "2.9.4",
    "jshint-stylish": "2.2.1",
    "jsonfile": "^2.4.0",
    "karma": "^1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "lite-server": "^2.2.2",
    "path": "0.12.7",
    "postcss-url": "^6.1.0",
    "require-dir": "^0.3.2",
    "rollup": "0.36.4",
    "rollup-plugin-commonjs": "5.0.5",
    "rollup-plugin-multi-entry": "2.0.1",
    "rollup-plugin-node-resolve": "2.0.0",
    "rollup-plugin-uglify": "1.0.1",
    "run-sequence": "1.2.2",
    "sync-exec": "0.6.2",
    "typescript": "2.3.3",
    "typings": "1.4.0",
    "uglify": "^0.1.5"
  }
}

最后是我使用的命令:

./node_modules/.bin/ngc -p ./tsconfig-aot.json --i18nFile="./app/compiled/localise.xlf" --locale=en --i18nFormat=xlf

任何帮助将不胜感激。 谢谢。

0 个答案:

没有答案