tb / ng2-nouislider

Angular2 noUiSlider directive
http://tb.github.io/ng2-nouislider/
MIT License
184 stars 114 forks source link

Unexpected value 'NouisliderModule' imported by 'UIComponentModule'. Please add a @NgModule annotation. #192

Closed cognition-dublin closed 5 years ago

cognition-dublin commented 6 years ago

I am trying to build my angular web app using ng build --prod .

At chunk optimization 92%, it always gives this error -

ERROR in : Unexpected value 'NouisliderModule in //node_modules/ng2-nouislider/src/nouislider.js' imported by the module 'UIComponentsModule in //src/app/components/ui-components.module.ts'. Please add a @NgModule annotation.

Can anyone tell me what is the meaning of this? I tried searching for this on several GitHub issues but no one has a fixed solution for this. This is what I get when I run ng --version -

Angular CLI: 1.7.4

Node: 6.10.2

OS: linux ia32

Angular: 5.2.11

... animations, common, compiler, compiler-cli, core, forms

... http, language-service, platform-browser

... platform-browser-dynamic, platform-server, router

@angular/cli: 1.7.4

@angular-devkit/build-optimizer: 0.3.2

@angular-devkit/core: 0.3.2

@angular-devkit/schematics: 0.3.2

@ngtools/json-schema: 1.2.0

@ngtools/webpack: 1.10.2

@schematics/angular: 0.3.2

@schematics/package-update: 0.3.2

typescript: 2.9.2

webpack: 3.11.0

(Sorry for my bad English, but any kind of help will be really appreciated.)

cognition-dublin commented 5 years ago

Got the answer after a week of searching for the solution. In the ui-components.module.ts file, I had -

import {NouisliderModule} from 'ng2-nouislider/src/nouislider';

which was changed to -

import {NouisliderModule} from 'ng2-nouislider';

This solved the error for me.

Closing the issue.