Skip to content

"Could not find an NgModule" when trying to generate a component and accessing the project directory trough a symlink #10684

@rdlf0

Description

@rdlf0

When your project directory is in a another directory, accessed through a symlink, ng generate component some-component can't find any NgModule.

Versions

Angular CLI: 6.0.0
Node: 8.11.1
OS: linux x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Developing on Bash on Ubuntu on Windows 10 1803.

Repro steps

  • Create a symlink to your dev directory (in my case /home/myuser/dev-> /mnt/d/dev)
  • Access your dev directory through the symlink
  • Create a new Angular project with ng new myNewProject
  • Get inside the newly created project directory with cd myNewPoject
  • Try to generate a new component with ng generate component some-component

Observed behavior

Could not find an NgModule. Use the skip-import option to skip importing in NgModule.

Desired behavior

It should generate a new component as if you were not following the symlink.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions