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

Created on 3 Jul 2019  Â·  18Comments  Â·  Source: nrwl/nx

  • [x] I am running the latest version
  • [x] I checked the documentation and found no answer
  • [x] I checked to make sure that this issue has not already been filed
  • [x] 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?

repro needed bug

Most helpful comment

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

All 18 comments

same problem

To try Ivy, please use the latest version of Angular which is 8.2.0-next.0.
That does not solve your problem here, just saying :)

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

Same problem, using 8.2.0-next.0

same problem

Folks. Could any of you provide a repo with a repro?

I got this error in a new workspace after running ng update @angular/core @angular/cli:

ERROR in ENOTDIR: not a directory, scandir '/Users/gperdomor/Downloads/nx-platform/libs/api-interface/src/index.ts'

After disabling ivy everything compiles fine

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

Yup, I know about the issue in the angular repo. I cannot repro the issue.

Folks, could you provide a repro?

@vsavkin here is a repo that exhibits the issue: https://github.com/wesleygrimes/nx-full-stack-issue-reproduction

I can reproduce from scratch by doing the following...

  • Create workspace $ npx create-nx-workspace@latest test-app
  • Choose the full stack option
  • Run ng update to see that rxjs and @angular/cli are out of date.
  • Run ng update @angular/cli @angular/core to update deps
  • Run ng serve test-app

The following error outputs:

 10% building 3/3 modules 0 activeℹ 「wds」: Project is running at http://localhost:4200/webpack-dev-server/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: 404s will fallback to //index.html

chunk {main} main.js, main.js.map (main) 2.23 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 157 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.09 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 16.7 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 341 kB [initial] [rendered]
Date: 2019-07-12T21:46:39.263Z - Hash: a49c2eb17832d0b4003e - Time: 1609ms

ERROR in ENOTDIR: not a directory, scandir '/Users/wes/sandbox/test-app/libs/api-interface/src/index.ts'
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
ℹ 「wdm」: Failed to compile.

If I go to test-app/apps/test-app/tsconfig.app.json and change angularCompilerOptions.enableIvy to false then it compiles successfully.

I wonder if perhaps there is an issue with the latest version of Angular which is 8.1.1.

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

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.

@gilhardl I did the same, and solved this issue for me. @vsavkin I think we should close this one, and advise users on Ivy, to upgrade to 8.2.0, or higher. I was able to run npm update from Angular 8.0.0, and didn't run across any issues

It looks like updating to Angular 8.2 resolves the problem. Thank you folks for troubleshooting it.

I'm going to close this issue.

i use angular version 8.2.6 and still have this problem with ivy

@larscom Might not fix your issue, but if you want to try Ivy, you should be on the next tag, currently 9.0.0-next.6.

Ivy Workspace Error

Was this page helpful?
0 / 5 - 0 ratings