Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
aguerot opened this issue Aug 29, 2018 · 5 comments · Fixed by #12567

Comments

@aguerot
Copy link

aguerot commented Aug 29, 2018

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';
@ngbot ngbot bot added this to the needsTriage milestone Aug 30, 2018
@alan-agius4
Copy link
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.

@alan-agius4 alan-agius4 added the needs: repro steps We cannot reproduce the issue with the information given label Aug 30, 2018
@aguerot
Copy link
Author

aguerot commented Aug 30, 2018

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.

@aguerot
Copy link
Author

aguerot commented Aug 30, 2018

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

@filipesilva
Copy link
Contributor

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

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
ikjelle pushed a commit to ikjelle/angular-cli that referenced this issue Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants