简体   繁体   English

Angular 8 Angular-cli 使用 ng build 生成 build 而不是 dist 目录

[英]Angular 8 Angular-cli generates build instead of dist directory with ng build

I have checked out a dozen questions on Stackoverflow, but it is still not working.我已经在 Stackoverflow 上检查了十几个问题,但它仍然不起作用。

I have the latest @angular/cli installed globally and also in my project.我在全球和我的项目中都安装了最新的 @angular/cli。 When I run ng version , this is the output:当我运行ng version ,这是输出:

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.之后,我使用ng build --prod ,它创建了一个构建目录而不是dist目录。

Part of folder structure:部分文件夹结构:

.vscode 
arm-templates 
build 
e2e 
node_modules 
server 
src 
deployment 
.gitignore 
angular.json 
azure-pipelines.yml 
buildscript.-s 

In your angular.json check outputPath .在您的angular.json检查outputPath It's set to build atm I suppose.我想它已经准备好建立 atm 了。 You can replace it with dist and so it will build into dist.你可以用 dist 替换它,这样它就会构建到 dist 中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM