Skip to content

Error: SampleModule is not an NgModule #3426

Closed
@beeman

Description

@beeman

OS?

macOS Sierra

Versions.

angular-cli: 1.0.0-beta.22
node: 7.2.0
os: darwin x64

Repro steps.

1. Scaffold new app:

$ ng new angular-sample-app --skip-git --skip-npm --style=scss --inline-template
$ cd angular-sample-app
$ yarn
$ git init
$ git add .
$ git commit -am "Initial commit"

2. Add dependency to angular-sample-module

This source to this module can be found here, and it's available on npmjs.

$ yarn add angular-sample-module

3. Add new module to AppModule

  • Edit src/app/app.module.ts
  • Add dependency: import { SampleModule } from 'angular-sample-module';
  • Add SampleModule to the imports array
  • Edit src/app/app.component.ts
  • Add <sampleComponent></sampleComponent> to the template

4. Start ng serve

$ ng serve
** NG Live Development Server is running on http://localhost:4200. **
 10% building modules 2/2 modules 0 active(node:18364) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: SampleModule is not an NgModule
(node:18364) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
 20% building modules 84/84 modules 0 active

The log given by the failure.

(node:17462) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: SampleModule is not an NgModule
(node:17462) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Mention any other details that might be useful.

Downgrading to the previous version of angular-cli makes it work:

$ npm install --save-dev angular-cli@1.0.0-beta.21

Link to a sample app showing the issue: https://github.com/beeman/angular-sample-app

Using ng new angular-sample-app without my custom parameters on version 1.0.0-beta.22 and npm install over yarn add yields the same results.

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