2

Today I've installed ng-bootstrap-modal into my angular 6.0.8 project. After ng serveing the following compile errors are displayed:

ERROR in node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.
node_modules/ng-bootstrap-modal/node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.

When I looked into the package dependencies I can see it's requiring angular 5.x.x (^5.0.0) and because of this (I think so) the installation created a folder node_modules\ng-bootstrap-modal\node_modules with another @angular as one of its subfolders which is causing the error I guess.

I read some threads on github and here about this that suggest (mostly) adding a "paths" property to the TS compiler options at tsconfig.json but I couldn't get it done, they are:

Some of my attempts were:

  • "paths": { "ng-bootstrap-modal/*": ["../ng-bootstrap-modal/src/*"] }
  • "paths": { "ng-bootstrap-modal/*": ["ng-bootstrap-modal/src/*"] }
  • "paths": { "@angular/*": ["node_modules/@angular/*"] } }

What I'd like to know is if there's some workaround (that doesn't involve downgrading my project to ^5.0.0) to make ng-bootstrap-modal to work or if this isn't possible at all so I start looking for other modals packages.

Any help is more than appreciated. Thanks in advance!

dcg
  • 4,187
  • 1
  • 18
  • 32
  • Well... what I posted may or may not be possible but either way I found a very easy-to-use package for displaying modals: [ngx-smart-modal](https://www.npmjs.com/package/ngx-smart-modal) – dcg Jan 05 '19 at 06:12

0 Answers0