angular-cli: [error] Error: EISDIR: Angular v17 using esbuild

🐞 Bug report

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

16

Description

When opting for the es-build feature over webpack. An exception occurred which does not have any context. This is unacceptable. It should at least print out on which file or directory the error occurred.

I simply change this in my angular.json file.

Fails:

"builder": "@angular-devkit/build-angular:browser-esbuild",

Works:

builder": "@angular-devkit/build-angular:browser",

Minimal Reproduction

ng build --configuration production --verbose

output:

> project@web.management@1.0.7 build
> ng build --configuration production --verbose

⠙ Building...

  polyfills-LZBJRJJE.js  32.7kb

⠇ Building...

  chunk-2FFGP3PS.js  993.4kb
  chunk-RCON6BW6.js  652.2kb
  main-HGXVCJ3H.js    59.1kb
  chunk-6BA7RJO3.js   31.1kb
  chunk-ZZLLJRB6.js   20.3kb
  chunk-2HU5B4AX.js   19.5kb
  chunk-4KKN7QDQ.js   14.4kb
  ...and 9 more output files...

An unhandled exception occurred: EISDIR: illegal operation on a directory, read
See "C:\Users\DOMINI~1\AppData\Local\Temp\ng-mDUayD\angular-errors.log" for further details.

Exception or Error

An unhandled exception occurred: EISDIR: illegal operation on a directory, read
See "C:\Users\DOMINI~1\AppData\Local\Temp\ng-mDUayD\angular-errors.log" for further details.

Content:

[error] Error: EISDIR: illegal operation on a directory, read

Your Environment

Angular CLI: 17.0.7
Node: 20.10.0
Package Manager: npm 10.2.5
OS: win32 x64

Angular: 17.0.7
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.7
@angular-devkit/build-angular   17.0.7
@angular-devkit/core            17.0.7
@angular-devkit/schematics      17.0.7
@angular/cdk                    17.0.4
@schematics/angular             17.0.7
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.2

Anything else relevant?

No response

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 20

Most upvoted comments

Agreed and we should provide a better error in this case

The problem appears to be caused because the index is set to an empty string in the production config. If you’d like to disable index generation. Set it to false instead of an empty string.

With:

"build": {
    "builder": "@angular-devkit/build-angular:browser-esbuild",
    "options": {
        "outputPath": "./dist/frontend",
        "index": "src/index.html",
        "main": "src/main.ts",
        "polyfills": "zone.js",
        "tsConfig": "tsconfig.app.json",
        "assets": [],
        "styles": [],
        "allowedCommonJsDependencies": [],
        "scripts": []
    },

No Change. Yes, the error also happens. The stack trace is identical.

That’s just node.js internal modules. Unfortunately however the stacktrace is not helpful as it doesn’t indicate the origin.

I am suspecting it’s something related to the assets, can you try to remove the assets array?