0

我的应用在Angular 5.2.6下

事情很正常ng serve

但是在运行时:ng build --prod需要一段时间,然后才会失败,并给出错误的痕迹。

这些错误似乎是在库文件夹中寻找文件,即使我现在没有使用。

这是错误的一部分:

looking for modules in /home/khalidvm/Desktop/Workspace/Front/frontend_v2/src
        using description file: /home/khalidvm/Desktop/Workspace/Front/frontend_v2/package.json (relative path: ./src)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /home/khalidvm/Desktop/Workspace/Front/frontend_v2/package.json (relative path: ./src)
          using description file: /home/khalidvm/Desktop/Workspace/Front/frontend_v2/package.json (relative path: ./src/ng2-completer/services/remote-data)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/khalidvm/Desktop/Workspace/Front/frontend_v2/src/ng2-completer/services/remote-data doesn't exist
            .ts

它似乎在搜索src/ng2-completer ,但即使我没有使用它。

这是我的package.json

{
  "name": "test",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "karma": "ng test",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:ci": "jest --runInBand",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.6",
    "@angular/common": "^5.2.6",
    "@angular/compiler": "^5.2.6",
    "@angular/core": "^5.2.6",
    "@angular/forms": "^5.2.6",
    "@angular/http": "^5.2.6",
    "@angular/platform-browser": "^5.2.6",
    "@angular/platform-browser-dynamic": "^5.2.6",
    "@angular/platform-server": "^5.2.6",
    "@angular/router": "^5.2.6",
    "angular-2-local-storage": "^1.0.1",
    "angular2-drag-scroll": "1.2.6",
    "angular2-jwt": "^0.2.3",
    "angular2-multiselect-dropdown": "1.3.6",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "file-saver": "^1.3.3",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "jest-preset-angular": "^2.0.5",
    "json2typescript": "1.0.5",
    "lodash": "^4.12.0",
    "moment": "^2.18.1",
    "ng-http-interceptor": "^3.1.2",
    "ng2-smart-table": "^1.1.0",
    "ngx-bootstrap": "2.0.2",
    "ngx-filesaver": "0.0.2",
    "ngx-modialog": "^5.0.0",
    "ngx-pagination": "^3.0.1",
    "ngx-tooltip": "0.0.9",
    "npm": "^5.2.0",
    "proxy-polyfill": "^0.1.7",
    "rxjs": "^5.5.6",
    "sha1": "^1.1.1",
    "smoothscroll-polyfill": "^0.3.5",
    "web-animations-js": "^2.2.5",
    "zone.js": "^0.8.8"
  },
  "devDependencies": {
    "@angular/cli": "1.6.8",
    "@angular/compiler-cli": "^5.2.6",
    "@types/jasmine": "2.5.38",
    "@types/jest": "^20.0.5",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "jest": "^20.0.4",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.0",
    "ts-jest": "^20.0.7",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
    "typescript": "2.4.2"
  },
  "jest": {
    "preset": "jest-preset-angular",
    "setupTestFrameworkScriptFile": "<rootDir>/src/setupJest.ts",
    "transformIgnorePatterns": [
      "node_modules/(?!json2typescript|angular2-multiselect-dropdown|ngx-filesaver|ngx-bootstrap|angular2-drag-scroll)"
    ]
  }
}

我已经清理了 npm 缓存,删除了package-lock.json 并重新安装了node_modules,但所有这些都没有让它工作。

建议?

4

1 回答 1

0

您应该检查 GitHub 页面上的 @angular-cli ( https://github.com/angular/angular-cli )。我相信这是一个已在 1.7+ 版本中修复的已知问题

有一个依赖项需要更新。

于 2018-02-28T14:25:24.853 回答