nx: compiling with ivy causes build to fail with ERROR in ENOTDIR: not a directory

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I’m reporting the issue to the correct repository (not related to Angular, AngularCLI or any dependency)

Expected Behavior

The project to build with ivy enabled

Current Behavior

The project fails to build stating that /src/index.ts is not a directory

Failure Information (for bugs)

I just updated to the latest angular 8.1.0 and tried to enable ivy in my project.

"angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "enableIvy": true
}

But I’ve been having troubles with the tsconfig.json path mappings.

if I enable ivy i get:

ERROR in ENOTDIR: not a directory, scandir '/Users/leon/project/libs/portal/feature-auth/src/index.ts'
"@leon/portal/feature-auth": ["libs/portal/feature-auth/src/index.ts"],

If i change the mapping to

"@leon/portal/feature-auth": ["libs/portal/feature-auth/src/"],

everything works

it seams that something is requiring that the typescript import is a directory and not a file.

Context

Please provide any relevant information about your setup:

Nx version used: 8.2.0
Angular CLI: 8.1.0
Node: 12.5.0
OS: darwin x64
Angular: 8.1.0
... animations, cli, common, compiler, compiler-cli, core
... elements, forms, language-service, platform-browser
... platform-browser-dynamic, router


Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.801.0
@angular-devkit/build-angular     0.801.0
@angular-devkit/build-optimizer   0.801.0
@angular-devkit/build-webpack     0.801.0
@angular-devkit/core              8.0.1
@angular-devkit/schematics        8.0.1
@angular/cdk                      8.0.2
@angular/fire                     5.2.1
@angular/material                 8.0.2
@ngtools/webpack                  8.1.0
@schematics/angular               8.1.0
@schematics/update                0.801.0
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.35.2

Failure Logs

ERROR in ENOTDIR: not a directory, scandir '/Users/leon/project/libs/portal/feature-auth/src/index.ts'
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
ℹ 「wdm」: Failed to compile.

Other

I tried to reproduce the error by creating a new nx workspace, but where unable to reproduce the error.

I’m not sure how I can debug where the log statement is coming from. I tried the --verbose setting but to no success.

any suggestions on how I can debug this?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 15
  • Comments: 19 (5 by maintainers)

Most upvoted comments

8.2.0-next.1 has solved the issue with ERROR in ENOTDIR: not a directory but the next one appeared then: ERROR in Unable to write a reference which is fully described here: angular/angular#29361 and there’s no workaround still

@vsavkin please take a look

I had the same error with Angular 8.1.2 : ERROR in ENOTDIR: not a directory, scandir '/c/Users/LG/code/git-mirroring/libs/api-interfaces/src/index.ts'

Updating angularCompilerOptions.enableIvy from /c/Users/LG/code/git-mirroring/apps/git-mirroring/tsconfig.app.json “fixed” the compilation error but was not a great workaround.

Upgrading Angular to 8.2.0 solved the problem for me. Now the app compiles well, with Ivy enabled.

Finally, there IS a workaround (which works in my project):

  1. update angular to 8.2.0-next.1
  2. append "rootDir": "." to the compilerOptions in the root tsconfig.json

Tested with 8.2.0-next.0 and the problem occurs on our side too