Angular-cli: "No module files found" when using cli to generate components

Created on 28 Feb 2017  路  4Comments  路  Source: angular/angular-cli

OS

OSX Sierra

Versions.

@angular/cli: 1.0.0-rc.0
node: 7.1.0

Repro steps.

ng g component [component-name]
installing component
Error locating module for declaration
    SilentError: No module files found

I tried everything mentioned in #https://github.com/angular/angular-cli/issues/2962 to no avail. I moved app.module.ts all over the place and attempted to generate component from varying directory paths, same error.

Most helpful comment

In my case i happen to have another .angular-cli.json file in my src folder. Removing it solved the problem

angular 4.1.1
angular-cli 1.0.1

All 4 comments

if you have same name with app.*
in my project , I have app.router.module.ts in src/app . I move it to src/app/routers/app.router.module.ts, the error is hidden.

In my case i happen to have another .angular-cli.json file in my src folder. Removing it solved the problem

angular 4.1.1
angular-cli 1.0.1

oh great phacic is right. thank you

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._

Was this page helpful?
0 / 5 - 0 ratings