0

I have checked out a dozen questions on Stackoverflow, but it is still not working.

I have the latest @angular/cli installed globally and also in my project. When I run ng version, this is the output:

Angular CLI: 8.3.23
Node: 10.15.3
OS: win32 x64
Angular: 8.0.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.23
@angular-devkit/build-angular     0.803.23
@angular-devkit/build-optimizer   0.803.23
@angular-devkit/build-webpack     0.803.23
@angular-devkit/core              8.3.23
@angular-devkit/schematics        8.3.23
@angular/cli                      8.3.23
@angular/http                     7.2.16
@ngtools/webpack                  8.3.23
@schematics/angular               8.3.23
@schematics/update                0.803.23
rxjs                              6.5.4
typescript                        3.4.5
webpack                           4.39.2

I tried

npm uninstall @angular/cli -g;
npm cache clean --force;
npm install @angular/cli -g;
npm cache verify;
close / open console;
cd <project>;
npm install;
ng --version; (result: 8.2.23)

Afterwards, I use ng build --prod, it creates a build directory instead of the dist directory.

Part of folder structure:

.vscode 
arm-templates 
build 
e2e 
node_modules 
server 
src 
deployment 
.gitignore 
angular.json 
azure-pipelines.yml 
buildscript.-s 
Andy Man
  • 1
  • 3
  • Can you share your angular.json? – maio290 Jan 31 '20 at 09:39
  • can you please share content of your `angular.json`? there is supposed to be something like `outputDir` – Blind Despair Jan 31 '20 at 09:39
  • check your file `angular.json`, there you has a "tag" **outputPath** (it's under projects-->your application-->architect-->build-->options ) – Eliseo Jan 31 '20 at 09:40
  • In the ```angular.json``` outPut path says **build**. When I replaced it with **dist** it worked as expected. Any idea why it is **build** by default? Cost me days to figure it out, should have asked for help earlier. – Andy Man Jan 31 '20 at 09:45
  • I mean **outputPath** instead of **outPut**. It solved my problem. Thanks. @BlindDespair – Andy Man Jan 31 '20 at 10:35
  • You're welcome, I'll post it as an answer, so that it would be either for others to spot it. – Blind Despair Jan 31 '20 at 10:44

1 Answers1

1

In your angular.json check outputPath. It's set to build atm I suppose. You can replace it with dist and so it will build into dist.

Blind Despair
  • 3,190
  • 2
  • 20
  • 31
  • Any idea why it is `build` by default? – Andy Man Jan 31 '20 at 11:16
  • as far as I know `dist/{projectName}` is default output. How old was this angular app? it might be that someone already set to build by hand or it used to build in older versions of angular(which I am not sure because I don't recall)... but if you do ng new with latest angular you will see that it sets to `dist` – Blind Despair Jan 31 '20 at 11:41
  • It is 2 months old created by me making use of Web Template Studio (https://marketplace.visualstudio.com/items?itemName=WASTeamAccount.WebTemplateStudio-dev-nightly). Maybe that is the problem, I did not expect Microsoft to deviate from `dist` and introduce `build` to fml. – Andy Man Jan 31 '20 at 12:01
  • 1
    I would definitely blame that. You can check it by creating another empty angular project using this tool and see what kind of `outputPath` it uses – Blind Despair Jan 31 '20 at 14:14