Skip to content

ng serve fails if file disappears #11217

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

Closed
alexfung888 opened this issue Jun 13, 2018 · 3 comments
Closed

ng serve fails if file disappears #11217

alexfung888 opened this issue Jun 13, 2018 · 3 comments
Labels
Milestone

Comments

@alexfung888
Copy link

alexfung888 commented Jun 13, 2018

Bug Report or Feature Request (mark with an x)

- [X ] bug report -> please search issues before submitting

Area

- [X ] devkit
- [ ] schematics

Versions

npm: 6.0.1

ng v output:

Angular CLI: 6.0.8
Node: 8.11.1
OS: win32 x64
Angular: 6.0.4
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cdk                      6.2.1
@angular/cli                      6.0.8
@angular/flex-layout              6.0.0-beta.16
@angular/material                 6.2.1
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.2.0
typescript                        2.7.2
webpack                           4.8.3

Repro steps

  • ng serve --aot
  • switch branch using git, so that some files disappear

The log given by the failure

Lots of errors in the form:
ERROR in ./src/app/todo/todo-routing.module.ts
Module build failed: Error: ENOENT: no such file or directory, open 'D:...\src\app\todo\todo-routing.module.ts'

Desired functionality

ng serve should compile the project.
Currently, need to break out of ng serve and start ng serve again.

Mention any other details that might be useful

This happens a lot when switching git branches. Whole directory with the new features could disapper: modules, routing modules, components. And ng serve will complain.

@alexfung888
Copy link
Author

alexfung888 commented Jun 13, 2018

Furthermore, when switching back to a branch with all the files (from the branch where the files do not exist), although ng serve successfully compiles the project, when I eventually navigate to the lazy loaded new module, I got:

core.js:1542 ERROR Error: Uncaught (in promise): Error: Cannot find 'TodoModule' in 'app/todo/todo.module'
Error: Cannot find 'TodoModule' in 'app/todo/todo.module'
    at checkNotEmpty (core.js:4854)
    at core.js:4840

I am not sure whether it is a CLI issue or core issue.

@alan-agius4
Copy link
Collaborator

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

@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 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants