fssolutions / ng2-wizard

MIT License
15 stars 7 forks source link

ERROR in Ng2WizardModule is not an NgModule #6

Closed fidlip closed 6 years ago

fidlip commented 7 years ago

I have installed ng2-wizard by running npm install --save ng2-wizard, then imported Ng2WizardModule to my module and got this error: ERROR in Ng2WizardModule is not an NgModule

fssolutions commented 7 years ago

What is version of angular used ?

fidlip commented 7 years ago

Hi, my environment was: angular-cli: 1.0.0-beta.24 node: 7.1.0 os: linux x64 @angular/common: 2.4.5 @angular/compiler: 2.4.5 @angular/core: 2.4.5 @angular/forms: 2.4.5 @angular/http: 2.4.5 @angular/platform-browser: 2.4.5 @angular/platform-browser-dynamic: 2.4.5 @angular/router: 3.4.5 @angular/compiler-cli: 2.4.5

matthewdickinson commented 7 years ago

I have the exact same error message:

My environment: Node: v7.7.3 OS: Linux x64


@angular/common@2.4.8
@angular/compiler@2.4.8
@angular/compiler-cli@2.4.10
@angular/core@2.4.8
@angular/forms@2.4.8
@angular/http@2.4.8
@angular/platform-browser@2.4.8
@angular/platform-browser-dynamic@2.4.8
@angular/router@3.4.8
ng2-wizard@2.0.7```
matthewdickinson commented 7 years ago

I think this is related to AOT compilation for Angular modules. (https://github.com/angular/angular-cli/issues/4247#issuecomment-275586177)

dongmei-cao commented 7 years ago

Happens in 2.4.9 too

@angular/cli: 1.0.0-rc.0 node: 7.6.0 os: darwin x64 @angular/common: 2.4.9 @angular/compiler: 2.4.9 @angular/core: 2.4.9 @angular/forms: 2.4.9 @angular/http: 2.4.9 @angular/platform-browser: 2.4.9 @angular/platform-browser-dynamic: 2.4.9 @angular/router: 3.4.9 @angular/cli: 1.0.0-rc.0 @angular/compiler-cli: 2.4.9

rbarcelos commented 7 years ago

any workaround?

sreinoso commented 7 years ago

I resolve it replacing the file node_modules/ng2-wizard/src/ng2-wizard.module.d.ts

export declare class Ng2WizardModule { }

to

import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common';

import { WizardComponent } from './wizard.component'; import { WizardStepComponent } from './wizard-step.component'; import { WizardStepTabComponent } from './wizard-step-tab.component';

@NgModule({ imports: [ CommonModule ], declarations: [ WizardComponent, WizardStepComponent, WizardStepTabComponent ], exports: [ WizardComponent, WizardStepComponent, WizardStepTabComponent ], }) export class Ng2WizardModule { }

I hope this help you.

kidx5452 commented 7 years ago

After change @NgModule for ng2-wizard.module.d.ts. i got this error: ERROR in Unexpected value 'WizardComponent in /node_modules/ng2-wizard/src/wizard.component.d.ts' declared by the module 'Ng2WizardModule in/node_modules/ng2-wizard/src/ng2-wizard.module.d.ts'. Please add a @Pipe/@Directive/@Component annotation.

fssolutions commented 6 years ago

Fixed with new version