Ошибка при запуске buil.prod в angular seed

Я клонировал последнюю версию angular seed, на которой основан мой личный проект.

Когда я запускаю npm run build.prod, я сталкиваюсь с этой проблемой на уровне build.bundles.app.

[09:35:49] Starting 'build.bundles.app'...
[09:35:51] 'build.bundles.app' errored after 2.04 s
[09:35:51] Error on fetch for @ng-bootstrap/ng-bootstrap at file:///node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js
    Loading dist/tmp/app/app.module.js
    Loading dist/tmp/app/main.js
    Error: ENOENT: no such file or directory, open '/node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js'
[09:35:51] 'build.prod' errored after 20 s
[09:35:51] Error in plugin 'run-sequence(build.bundles.app)'
Message:
    Error on fetch for @ng-bootstrap/ng-bootstrap at file:///node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js
    Loading dist/tmp/app/app.module.js
    Loading dist/tmp/app/main.js
    ENOENT: no such file or directory, open '/node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js'
Details:
    originalErr: Error: ENOENT: no such file or directory, open '/node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js'
Stack:
Error on fetch for @ng-bootstrap/ng-bootstrap at file:///node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js
    Loading dist/tmp/app/app.module.js
    Loading dist/tmp/app/main.js
    Error: ENOENT: no such file or directory, open '/node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js'

npm ERR! Linux 4.4.0-43-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build.prod"
npm ERR! node v7.0.0
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build.prod: `gulp build.prod --color --env-config prod --build-type prod`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build.prod script 'gulp build.prod --color --env-config prod --build-type prod'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     gulp build.prod --color --env-config prod --build-type prod
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular-seed
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular-seed
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /media/chaker/32546EDF546EA4F7/Chaker_Mallek/Vynd/Freelance/E-need/e-need-angular2/npm-debug.log

Вот мой файл package.json

{
  "name": "angular-seed",
  "version": "0.0.0",
  "description": "Modular starter project for Angular 2 (and beyond) with statically typed build and AoT compilation",
  "repository": {
    "url": "https://github.com/mgechev/angular-seed"
  },
  "scripts": {
    "build.dev": "gulp build.dev --color --env-config dev",
    "build.dev.watch": "gulp build.dev.watch --color",
    "build.e2e": "gulp build.e2e --color",
    "build.prod": "gulp build.prod --color --env-config prod --build-type prod",
    "build.prod.exp": "gulp build.prod.exp --color --env-config prod --build-type prod",
    "build.test": "gulp build.test --color",
    "test.watch": "gulp test.watch --color",
    "generate.manifest": "gulp generate.manifest --color",
    "e2e": "protractor",
    "e2e.live": "protractor --elementExplorer",
    "gulp": "gulp",
    "i18n": "ng-xi18n && gulp clean.i18n",
    "lint": "gulp tslint",
    "karma": "karma",
    "karma.start": "karma start",
    "postinstall": "gulp check.versions && gulp build.bundle.rxjs && npm prune && gulp webdriver && gulp print.banner",
    "reinstall": "npm cache clean && npm install",
    "serve.coverage": "gulp serve.coverage --color",
    "serve.dev": "gulp serve.dev --color --env-config dev",
    "serve.e2e": "gulp serve.e2e --color",
    "serve.prod": "gulp serve.prod --color --env-config prod",
    "serve.prod.exp": "gulp serve.prod.exp --color --env-config prod",
    "start": "gulp serve.dev --color",
    "start.deving": "gulp start.deving --color",
    "tasks.list": "gulp --tasks-simple --color",
    "test": "gulp test --color",
    "e2e.ci": "gulp build.prod --color && gulp build.js.e2e --color && gulp e2e --color",
    "tests.all": "npm test && npm run e2e.ci",
    "webdriver-start": "webdriver-manager start",
    "webdriver-update": "webdriver-manager update"
  },
  "author": "Minko Gechev <mgechev>",
  "license": "MIT",
  "devDependencies": {
    "@angular/compiler-cli": "~2.1.2",
    "@angular/platform-server": "~2.1.2",
    "@angular/tsc-wrapped": "0.3.0",
    "@types/async": "^2.0.32",
    "@types/browser-sync": "^0.0.34",
    "@types/core-js": "^0.9.34",
    "@types/express": "^4.0.33",
    "@types/gulp": "^3.8.32",
    "@types/gulp-filter": "^3.0.29",
    "@types/gulp-load-plugins": "^0.0.28",
    "@types/gulp-protractor": "^1.0.29",
    "@types/gulp-sass": "^0.0.29",
    "@types/gulp-util": "^3.0.29",
    "@types/jasmine": "^2.5.35",
    "@types/node": "^6.0.45",
    "@types/protractor": "^1.5.20",
    "@types/rimraf": "0.0.28",
    "@types/run-sequence": "^0.0.28",
    "@types/selenium-webdriver": "2.44.*",
    "@types/systemjs": "^0.19.31",
    "@types/yargs": "^0.0.34",
    "@types/zone.js": "^0.0.27",
    "async": "^2.1.1",
    "autoprefixer": "^6.5.1",
    "browser-sync": "^2.17.3",
    "codelyzer": "~1.0.0-beta.2",
    "connect-history-api-fallback": "^1.3.0",
    "cssnano": "^3.7.7",
    "deep-extend": "^0.4.1",
    "event-stream": "^3.3.4",
    "express": "~4.14.0",
    "express-history-api-fallback": "^2.0.0",
    "gulp": "^3.9.1",
    "gulp-cached": "^1.1.0",
    "gulp-concat": "^2.6.0",
    "gulp-concat-css": "^2.3.0",
    "gulp-filter": "^4.0.0",
    "gulp-inject": "^4.1.0",
    "gulp-inline-ng2-template": "^4.0.0",
    "gulp-load-plugins": "^1.3.0",
    "gulp-plumber": "~1.1.0",
    "gulp-postcss": "^6.2.0",
    "gulp-progeny": "^0.3.1",
    "gulp-protractor": "^3.0.0",
    "gulp-replace": "^0.5.4",
    "gulp-sass": "^2.3.2",
    "gulp-sourcemaps": "2.2.0",
    "gulp-template": "^4.0.0",
    "gulp-tslint": "^6.1.2",
    "gulp-typescript": "^3.0.2",
    "gulp-uglify": "^2.0.0",
    "gulp-util": "^3.0.7",
    "gulp-watch": "^4.3.10",
    "is-ci": "^1.0.9",
    "isstream": "^0.1.2",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "^2.7.0",
    "karma": "~1.3.0",
    "karma-chrome-launcher": "~2.0.0",
    "karma-coverage": "^1.1.1",
    "karma-jasmine": "~1.0.2",
    "karma-mocha-reporter": "^2.2.0",
    "karma-remap-istanbul": "^0.2.1",
    "merge-stream": "^1.0.0",
    "open": "0.0.5",
    "protractor": "^4.0.9",
    "remap-istanbul": "^0.7.0",
    "rimraf": "^2.5.4",
    "run-sequence": "^1.2.2",
    "semver": "^5.3.0",
    "serve-static": "^1.11.1",
    "slash": "~1.0.0",
    "supports-color": "^3.1.2",
    "systemjs-builder": "0.15.33",
    "tildify": "^1.2.0",
    "traceur": "^0.0.111",
    "ts-node": "^1.4.3",
    "tslint": "^3.15.1",
    "typescript": "^2.0.3",
    "walk": "^2.3.9",
    "yargs": "^6.0.0"
  },
  "dependencies": {
    "@angular/common": "~2.1.2",
    "@angular/compiler": "~2.1.2",
    "@angular/core": "~2.1.2",
    "@angular/forms": "~2.1.2",
    "@angular/http": "~2.1.2",
    "@angular/platform-browser": "~2.1.2",
    "@angular/platform-browser-dynamic": "~2.1.2",
    "@angular/router": "~3.1.2",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.11",
    "angular-in-memory-web-api": "~0.1.13",
    "angular2-google-maps": "^0.15.0",
    "class-transformer": "^0.1.2",
    "core-js": "^2.4.1",
    "intl": "^1.2.5",
    "minimatch": "^3.0.3",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.0.0-beta.12",
    "systemjs": "0.19.40",
    "zone.js": "0.6.25"
  }
}

А вот мой tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "declaration": false,
    "removeComments": true,
    "noLib": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": ["es6", "es2015", "dom"],
    "sourceMap": true,
    "pretty": true,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitUseStrict": false,
    "noFallthroughCasesInSwitch": true,
    "typeRoots": [
      "./node_modules/@types",
      "./node_modules"
    ],
    "types": [
      "core-js",
      "jasmine",
      "node"
    ]
  },
  "exclude": [
    "node_modules",
    "dist",
    "src"
  ],
  "compileOnSave": false
}

и вот мои инструменты/config/project.config.ts, которые я переопределил

import {join} from 'path';

import {SeedConfig} from './seed.config';
import {ExtendPackages} from './seed.config.interfaces';

/**
 * This class extends the basic seed configuration, allowing for project specific overrides. A few examples can be found
 * below.
 */
export class ProjectConfig extends SeedConfig {

  PROJECT_TASKS_DIR = join(process.cwd(), this.TOOLS_DIR, 'tasks', 'project');

  constructor() {
    super();
    this.APP_TITLE = 'e-need';

    /* Enable typeless compiler runs (faster) between typed compiler runs. */
    // this.TYPED_COMPILE_INTERVAL = 5;

    // Add `NPM` third-party libraries to be injected/bundled.
    this.NPM_DEPENDENCIES = [
      ...this.NPM_DEPENDENCIES,
      // {src: 'jquery/dist/jquery.min.js', inject: 'libs'},
      // {src: 'lodash/lodash.min.js', inject: 'libs'},
    ];

    // Add `local` third-party libraries to be injected/bundled.
    this.APP_ASSETS = [
      ...this.APP_ASSETS,
      // {src: `${this.APP_SRC}/your-path-to-lib/libs/jquery-ui.js`, inject: true, vendor: false}
      // {src: `${this.CSS_SRC}/path-to-lib/test-lib.css`, inject: true, vendor: false},
    ];

    // Add packages (e.g. lodash)
    // let additionalPackages: ExtendPackages[] = [{
    //   name: 'lodash',
    //   path: `${this.APP_BASE}node_modules/lodash/lodash.js`,
    //   packageMeta: {
    //     main: 'index.js',
    //     defaultExtension: 'js'
    //   }
    // }];
    //
    // or
    //
    // let additionalPackages: ExtendPackages[] = [];
    //
    // additionalPackages.push({
    //   name: 'lodash',
    //   path: `${this.APP_BASE}node_modules/lodash/lodash.js`,
    //   packageMeta: {
    //     main: 'index.js',
    //     defaultExtension: 'js'
    //   }
    // });
    //
    // this.addPackagesBundles(additionalPackages);

    /* Add to or override NPM module configurations: */
    // this.mergeObject(this.PLUGIN_CONFIGS['browser-sync'], { ghostMode: false });


    let additionalPackages: ExtendPackages[] = [{
      name: 'class-transformer',
      path: `${this.APP_BASE}node_modules/class-transformer`,
      packageMeta: {
        main: 'index.js',
        defaultExtension: 'js'
      }
    },{
      name: 'angular-in-memory-web-api',
      path: `${this.APP_BASE}node_modules/angular-in-memory-web-api/bundles/in-memory-web-api.umd.js`
    },{
      name: '@ng-bootstrap/ng-bootstrap',
      path: `${this.APP_BASE}node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js`
    },{
      name: 'angular2-google-maps/core',
      path: `${this.APP_BASE}node_modules/angular2-google-maps/core/core.umd.js`
    }];

    this.addPackagesBundles(additionalPackages);
    //this.mergeObject(this.PLUGIN_CONFIGS['browser-sync'], { ghostMode: false });

  }

}

Я не модифицировал какой-либо другой файл конфигурации angular seed.

Я работаю на узле v7.0.0 и npm v3.10.8.


person MChaker    schedule 18.11.2016    source источник


Ответы (1)


Я отправил эту проблему на github и решил ее с помощью @ZuSe.

Решение состоит в следующем:

Измените APP_BASE на NPM_BASE в project.config.ts вот так

let additionalPackages: ExtendPackages[] = [{
      name: 'class-transformer',
      path: `${this.NPM_BASE}node_modules/class-transformer`,
      packageMeta: {
        main: 'index.js',
        defaultExtension: 'js'
      }
    },{
      name: 'angular-in-memory-web-api',
      path: `${this.NPM_BASE}node_modules/angular-in-memory-web-api/bundles/in-memory-web-api.umd.js`
    },{
      name: '@ng-bootstrap/ng-bootstrap',
      path: `${this.NPM_BASE}node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js`
    },{
      name: 'angular2-google-maps/core',
      path: `${this.NPM_BASE}node_modules/angular2-google-maps/core/core.umd.js`
    }];

И добавьте строку кода в seed.config.ts

/**
   * The system builder configuration of the application.
   * @type {any}
   */
  SYSTEM_BUILDER_CONFIG: any = {
    defaultJSExtensions: true,
    base: this.PROJECT_ROOT,
    packageConfigPaths: [
      join('node_modules', '*', 'package.json'),
      join('node_modules', '@angular', '*', 'package.json'),
      join('node_modules', '@ng-bootstrap', '*', 'package.json') // I have added this line
    ],
    paths: {
      // some code
    },
    packages: {
      // some code
    }
  };
person MChaker    schedule 22.11.2016
comment
Не знаю, подходит ли этот ответ для темы, но сегодня днем ​​он спас мне жизнь с помощью @swimlane/ngx-datatable. - person Einsamer; 04.08.2017