Unable to run "ng build" Angular 12.1.0


I’ve just made a new Angular project with ng new app-name but when i try to build a production release i get the following error:

Generating browser application bundles (phase: setup)
...An unhandled exception occurred: 
ENOENT: no such file or directory, stat 'E:\Angular\museum-kiosk\dist\museum-kiosk'
See "C:\Users\imytyuk\AppData\Local\Temp\ng-dPVXDC\angular-errors.log" for further details.

While in the log file i got this:

[error] Error: ENOENT: no such file or directory, stat 'E:\Angular\museum-kiosk\dist\museum-kiosk'
    at Object.statSync (node:fs:1527:3)
    at __node_internal_ (node:internal/fs/utils:767:8)
    at Object.rmdirSync (node:fs:1147:15)
    at Object.deleteOutputDir (E:\Angular\museum-kiosk\node_modules\@angular-devkit\build-angular\src\utils\delete-output-dir.js:21:10)
    at initialize (E:\Angular\museum-kiosk\node_modules\@angular-devkit\build-angular\src\browser\index.js:86:17)
    at async SwitchMapSubscriber.project (E:\Angular\museum-kiosk\node_modules\@angular-devkit\build-angular\src\browser\index.js:114:17)

I’ve tried to add the mkdir dist in my package.json > build but nothing changed…

I’ve tried to change
import { AppModule } from './app/app.module'; to import { AppModule } from './app/'; in main.ts, but nothing…


As far as I can tell this is a problem with @angular-devkit/build-angular which is hopefully being worked on.

It can be overcome by running (in your case)

mkdirp dist\museum-kiosk

before you build.

Answered By – zen

Answer Checked By – Robin (AngularFixing Admin)

Leave a Reply

Your email address will not be published.