Проект «производство» не может быть найден в рабочей области, когда я создаю угловой проект для производства - PullRequest
0 голосов
/ 05 мая 2018

Я новичок в Angular. Я использую эту команду ng build --target=production --base-href /, и вот ошибка, которая выдает при сборке угловой проект для производства.

Project 'production' could not be found in workspace.
Error: Project 'production' could not be found in workspace.
    at Workspace.getProject (/home/linux/Downloads/weather/node_modules/@angular-devkit/core/src/workspace/workspace.js:83:19)
    at Architect.getBuilderConfiguration (/home/linux/Downloads/weather/node_modules/@angular-devkit/architect/src/architect.js:96:41)
    at MergeMapSubscriber._loadWorkspaceAndArchitect.pipe.operators_1.concatMap [as project] (/home/linux/Downloads/weather/node_modules/@angular/cli/models/architect-command.js:77:55)
    at MergeMapSubscriber._tryNext (/home/linux/Downloads/weather/node_modules/rxjs/internal/operators/mergeMap.js:122:27)
    at MergeMapSubscriber._next (/home/linux/Downloads/weather/node_modules/rxjs/internal/operators/mergeMap.js:112:18)
    at MergeMapSubscriber.Subscriber.next (/home/linux/Downloads/weather/node_modules/rxjs/internal/Subscriber.js:103:18)
    at TapSubscriber._next (/home/linux/Downloads/weather/node_modules/rxjs/internal/operators/tap.js:109:26)
    at TapSubscriber.Subscriber.next (/home/linux/Downloads/weather/node_modules/rxjs/internal/Subscriber.js:103:18)
    at MergeMapSubscriber.notifyNext (/home/linux/Downloads/weather/node_modules/rxjs/internal/operators/mergeMap.js:141:26)
    at InnerSubscriber._next (/home/linux/Downloads/weather/node_modules/rxjs/internal/InnerSubscriber.js:30:21)

1 Ответ

0 голосов
/ 19 июня 2018

Это случилось со мной после обновления с Angular 5 до Angular 6.

Решение заключается в замене на angular.json:

"prod": {
  "fileReplacements": [
    {
      "replace": "src/environments/environment.ts",
      "with": "src/environments/environment.prod.ts"
    }
  ]
},

с:

"production": {
  "fileReplacements": [
    {
      "replace": "src/environments/environment.ts",
      "with": "src/environments/environment.prod.ts"
    }
  ]
},

так что в основном речь идет о переименовании prod в production.

...