Angular 6失败---prod标志

问题描述 投票:0回答:1

您好,我使用Angular CLI将近两年来遇到此错误。我用谷歌搜索,但找不到该问题的任何解决方案。

 Can't resolve all parameters for BaseService in E:/**/web/src/app/shared/services/base.service.ts: ([object Object], ?, ?, ?). This will become an error in Angular v6.x

当我运行此命令时

 ng build --output-hashing none  --prod --build-optimizer=false 

我使用--prod标签构建时,无法构建角度。它显示一个随机错误,例如:

    ERROR in : Unexpected value 'component in E:/**/web/src/app/shared/index.ts' imported by the module 'BlotterModule in E:/***/web/src/app/modules/blotter/blotter.module.ts'. Please add a @NgModule annotation.

错误中提到的索引文件是

import * as Services from './services';
import * as directives from './directives';
import * as pipes from './pipes';
import * as component from './components';
import * as guards from './guards';

export {
  component,
  Services,
  directives,
  pipes,
  guards
}

我的package.json文件是

{
  "name": "epricing",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng build --watch --output-hashing none && ng serve -o --proxy-config proxy.config.json ",
    "build": "ng build --extract-css",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "mi:prod": "ng build --output-hashing none --base-href /DevInet.ePricing.MultiTaux.Web/",
    "run:prod": "ng build --output-hashing none --prod --build-optimizer=false --base-href /DevInet.ePricing.MultiTaux.Web/"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.1.10",
    "@angular/cdk": "^7.0.2",
    "@angular/common": "^6.1.0",
    "@angular/compiler": "^6.1.0",
    "@angular/core": "^6.1.0",
    "@angular/forms": "^6.1.0",
    "@angular/http": "^6.1.0",
    "@angular/material": "^7.0.2",
    "@angular/platform-browser": "^6.1.0",
    "@angular/platform-browser-dynamic": "^6.1.0",
    "@angular/router": "^6.1.0",
    "@ng-bootstrap/ng-bootstrap": "^2.0.0",
    "@ng-select/ng-select": "^2.9.1",
    "@ngrx/effects": "^6.1.0",
    "@ngrx/entity": "^6.1.0",
    "@ngrx/store": "^6.1.0",
    "@ngrx/store-devtools": "^6.1.0",
    "@sweetalert2/ngx-sweetalert2": "^5.1.0",
    "angular-svg-round-progressbar": "^3.0.1",
    "angular-user-idle": "^2.2.1",
    "bootstrap": "^4.1.3",
    "chart.js": "^2.8.0",
    "core-js": "^2.5.4",
    "file-saver": "^2.0.0",
    "font-awesome": "^4.7.0",
    "gsap": "^2.0.2",
    "guid-typescript": "^1.0.9",
    "hammerjs": "^2.0.8",
    "imports-loader": "^0.8.0",
    "jquery": "^3.3.1",
    "lodash": "^4.17.11",
    "moment": "^2.22.2",
    "ng-circle-progress": "^1.5.1",
    "ngrx-store-logger": "^0.2.2",
    "ngx-bootstrap": "^3.2.0",
    "ngx-cookie-service": "^2.1.0",
    "ngx-toastr": "^9.1.0",
    "node-sass": "^4.9.0",
    "popper.js": "^1.14.3",
    "primeicons": "^1.0.0-beta.10",
    "primeng": "^6.0.2",
    "rxjs": "^6.0.0",
    "string": "^3.3.3",
    "sweetalert2": "^8.13.6",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.7.0",
    "@angular/cli": "~6.1.1",
    "@angular/compiler-cli": "^6.1.0",
    "@angular/language-service": "^6.1.0",
    "@ngrx/schematics": "^6.1.0",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/lodash": "^4.14.116",
    "@types/node": "~8.9.4",
    "chai": "^4.1.2",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~2.7.2"
  }
}

我的tsconfig.json是

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types",
      "node",
      "greensock"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  }
}

这个问题对我来说变得至关重要。请可以有人尝试看看是否有我没有看到的问题

angular angular6
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.