Skip to content

ng build fails w/ ERROR in ENOENT: no such file or directory, stat 'C:\C\code\##removed##\src\app\app.module.ts' #12035

Closed

Description

@aguerot

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [x] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

node v8.9.4
npm 6.2.0

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / ??? \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 6.1.3
Node: 8.9.4
OS: win32 x64
Angular: 6.1.3
... animations, cli, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router, service-worker

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.7.3
@angular-devkit/build-angular      0.7.3
@angular-devkit/build-optimizer    0.7.3
@angular-devkit/build-webpack      0.7.3
@angular-devkit/core               0.7.3
@angular-devkit/schematics         0.7.3
@angular/cdk                       6.4.1
@angular/flex-layout               6.0.0-beta.17
@angular/material                  6.4.1
@angular/material-moment-adapter   6.4.1
@ngtools/webpack                   6.1.3
@schematics/angular                0.7.3
@schematics/update                 0.7.3
rxjs                               6.2.2
typescript                         2.9.2
webpack                            4.9.2

Windows 10 (can't repro on Linux and MacOS)

Repro steps

ng build

The log given by the failure

Date: 2018-08-29T15:03:14.135Z
Hash: e414d3901afd066b8b88
Time: 13253ms
chunk {main} main.js, main.js.map (main) 1.93 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 684 bytes [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 5.22 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 249 kB  [rendered]
chunk {styles} styles.js, styles.js.map (styles) 566 kB [initial] [rendered]chunk {vendor} vendor.js, vendor.js.map (vendor) 325 kB [initial] [rendered]
ERROR in ENOENT: no such file or directory, stat 'C:\C\code\##removed##\src\app\app.module.ts'
i 「wdm」: Failed to compile.

Desired functionality

Build app successfully

Mention any other details that might be useful

I found weird that the path logged in the error message mentions C drive twice ->"C:\C\code"
Project was originaly created in previous version of Angular and upgraded to ng6. Issue appeared after the migration to ng6

Workaround

I managed to compile my application if I change my file \src\app\index.ts from this

export { AppModule } from './app.module';

to this

export * from './app.module';

Activity

  1. added this to the needsTriage milestone on Aug 30, 2018
  2. alan-agius4 commented on Aug 30, 2018

    @alan-agius4
    Collaborator

    This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?

    You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

    This might be related to your directory structure so its really important to get an accurate repro to diagnose this.

  3. aguerot commented on Aug 30, 2018

    @aguerot
    Author

    I was hoping that the duplicated drive in path ("C:\C\code") would ring some bells.
    I understand the need for repro-app, I'm going to try to setup a minimal repro-app and share asap.

  4. aguerot commented on Aug 30, 2018

    @aguerot
    Author

    You can clone this repo https://github.com/aguerot/angular-cli-issue-12035 for repro project

    This is a barebone project generated w/ ng new repro-app where I added an index.ts file in app folder to export AppModule and updated main.ts to import from import { AppModule } from './app'; instead of import { AppModule } from './app/app.module';

    see app/index.ts for offending code and workaround I found

  5. filipesilva commented on Sep 3, 2018

    @filipesilva
    Contributor

    I think this might be a problem with our barrel following logic.

  6. modified the milestones: needsTriage, Backlog on Sep 3, 2018
  7. added 2 commits that reference this issue on Oct 16, 2018
    d0bea7a
    16d5eac
  8. angular-automatic-lock-bot commented on Sep 8, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  9. locked and limited conversation to collaborators on Sep 8, 2019
  10. added a commit that references this issue on Mar 26, 2024
    26dbe6a
  11. added a commit that references this issue on May 29, 2026
    15fd280
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions