Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic 2 angular-moment-timezone - Cannot redeclare block-scoped variable 'tz'

I'm not exactly sure what I did, but I installed angular-moment-timezone in my Ionic project today, got it working, could run ionic serve just fine, but then I decided to remove my node_modules folder. Once I did that, I ran npm i and once that all finished, anytime I try to run ionic serve, I get these errors:

Typescript Error

Cannot redeclare block-scoped variable 'tz'.
node_modules/@types/moment-timezone/index.d.ts

undefined
undefined

Typescript Error

Cannot redeclare block-scoped variable 'tz'.
node_modules/angular-moment-timezone/node_modules/@types/moment-timezone/index.d.ts

undefined
undefined

I have no idea what I did wrong and I haven't found anything that can help so far. Has anyone else had this same issue?

like image 853
Stevie Star Avatar asked Apr 07 '18 00:04

Stevie Star


1 Answers

We have the @types/moment-timezone in our dependency which causes the error.

cannot redeclare block-scoped variable 'tz' moment-timezone

Since moment-timezone version 0.5.30, d.ts files will be inside moment-timezone. You can save remove it

npm uninstall @types/moment-timezone

like image 50
LeOn - Han Li Avatar answered Oct 20 '22 20:10

LeOn - Han Li