urish/ngx-moment

Problems with moment 2.25.0

tarlepp opened this issue · 16 comments

Description of the Issue and Steps to Reproduce:

Did you search for duplicate issue? [Yes / No]

After I updated my moment to version 2.25.0 I've followed issues when Angular is compiling;

node_1  | ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 237:15-23
node_1  | "export 'duration' was not found in 'moment'
node_1  | ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 606:12-18
node_1  | "export 'isDate' was not found in 'moment'
node_1  | ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 68:52-60
node_1  | "export 'isMoment' was not found in 'moment'
node_1  | ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 609:17-25
node_1  | "export 'isMoment' was not found in 'moment'
node_1  | ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 621:15-23
node_1  | "export 'isMoment' was not found in 'moment'
node_1  | ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 621:50-56
node_1  | "export 'locale' was not found in 'moment'
node_1  | ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 451:15-24
node_1  | "export 'parseZone' was not found in 'moment'
node_1  | ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 253:16-37
node_1  | "export 'relativeTimeThreshold' was not found in 'moment'
node_1  | ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 288:15-19
node_1  | "export 'unix' was not found in 'moment'
node_1  | ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 333:25-28
node_1  | "export 'utc' was not found in 'moment'
node_1  | ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 333:47-50
node_1  | "export 'utc' was not found in 'moment'
node_1  |     
node_1  |     ERROR in node_modules/ngx-moment/add.pipe.d.ts:2:25 - error TS2307: Cannot find module 'moment'.
node_1  |     
node_1  |     2 import * as moment from 'moment';
node_1  |                               ~~~~~~~~
node_1  |     node_modules/ngx-moment/calendar.pipe.d.ts:2:25 - error TS2307: Cannot find module 'moment'.
node_1  |     
node_1  |     2 import * as moment from 'moment';
node_1  |                               ~~~~~~~~
node_1  |     node_modules/ngx-moment/date-format.pipe.d.ts:2:25 - error TS2307: Cannot find module 'moment'.
node_1  |     
node_1  |     2 import * as moment from 'moment';
node_1  |                               ~~~~~~~~
node_1  |     node_modules/ngx-moment/difference.pipe.d.ts:2:25 - error TS2307: Cannot find module 'moment'.
node_1  |     
node_1  |     2 import * as moment from 'moment';
node_1  |                               ~~~~~~~~
node_1  |     node_modules/ngx-moment/parse.pipe.d.ts:2:25 - error TS2307: Cannot find module 'moment'.
node_1  |     
node_1  |     2 import * as moment from 'moment';
node_1  |                               ~~~~~~~~
node_1  |     node_modules/ngx-moment/subtract.pipe.d.ts:2:25 - error TS2307: Cannot find module 'moment'.
node_1  |     
node_1  |     2 import * as moment from 'moment';
node_1  |                               ~~~~~~~~
node_1  |     node_modules/ngx-moment/time-ago.pipe.d.ts:2:25 - error TS2307: Cannot find module 'moment'.
node_1  |     
node_1  |     2 import * as moment from 'moment';
node_1  |                               ~~~~~~~~
node_1  |     node_modules/ngx-moment/utc.pipe.d.ts:2:25 - error TS2307: Cannot find module 'moment'.
node_1  |     
node_1  |     2 import * as moment from 'moment';
node_1  |                               ~~~~~~~~
node_1  |     node_modules/ngx-moment/local.pipe.d.ts:2:25 - error TS2307: Cannot find module 'moment'.
node_1  |     
node_1  |     2 import * as moment from 'moment';
node_1  |                               ~~~~~~~~
node_1  |     node_modules/ngx-moment/locale.pipe.d.ts:2:25 - error TS2307: Cannot find module 'moment'.
node_1  |     
node_1  |     2 import * as moment from 'moment';
node_1  |                               ~~~~~~~~
node_1  |     node_modules/ngx-moment/parse-zone.pipe.d.ts:2:25 - error TS2307: Cannot find module 'moment'.
node_1  |     
node_1  |     2 import * as moment from 'moment';
node_1  |                               ~~~~~~~~
node_1  |     node_modules/ngx-moment/is-before.pipe.d.ts:1:25 - error TS2307: Cannot find module 'moment'.
node_1  |     
node_1  |     1 import * as moment from 'moment';
node_1  |                               ~~~~~~~~
node_1  |     node_modules/ngx-moment/is-after.pipe.d.ts:1:25 - error TS2307: Cannot find module 'moment'.
node_1  |     
node_1  |     1 import * as moment from 'moment';
node_1  |                               ~~~~~~~~

Ensure your issue is isolated to ngx-moment. Issues involving third party tools will be closed unless submitted by the tool's author/maintainer.

Environment:

Please answer the following questions:

  • Angular version?
    9.1.4
  • TypeScript version?
    3.8.3
  • moment version?
    2.25.0
  • Are you using moment-timezone?
    yes, version 0.5.28
  • Are you using the angular-cli?
    yes, version 9.1.4
  • Using Rollup/Webpack/System.js/Ionic/similar?
    n/a

Looks like this issue is actually caused by moment itself.
See moment/moment#5491

Digging into the source for this lib - it just pulls in the latest minor version of moment, meaning when it is installed it will currently pull the defective version of moment, which is 2.25.0.

it looks like a fix has been released, but I imagine ngx-moment needs to upgrade their dependency to pull it in. Once that happens we should be good to go. moment is a peer dependency so installing 2.25.1 should fix it. ...doesn't seem to resolve it for me.

I had to npm cache clear --hard. If that doesn't work then try dumping the node_modules folder.

Still not working with 2.25.1:

WARNING in ./node_modules/moment/src/lib/locale/locales.js
Module not found: Error: Can't resolve './locale' in 'D:\Desarrollo\SendGround\pwa\node_modules\moment\src\lib\locale'

ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 237:15-23
"export 'duration' was not found in 'moment'
ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 606:12-18
"export 'isDate' was not found in 'moment'
ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 68:52-60
"export 'isMoment' was not found in 'moment'
ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 609:17-25
"export 'isMoment' was not found in 'moment'
ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 621:15-23
"export 'isMoment' was not found in 'moment'
ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 621:50-56
"export 'locale' was not found in 'moment'
ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 451:15-24
"export 'parseZone' was not found in 'moment'
ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 253:16-37
"export 'relativeTimeThreshold' was not found in 'moment'
ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 288:15-19
"export 'unix' was not found in 'moment'
ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 333:25-28
"export 'utc' was not found in 'moment'
ERROR in ./node_modules/ngx-moment/__ivy_ngcc__/fesm2015/ngx-moment.js 333:47-50
"export 'utc' was not found in 'moment'

Also not working dumpling node_modules or running npm cache clear --hard

What does your package.json look like? A workaround I have tested is to just to use moment 2.24.0 alongside ngx-moment.

@nickyg91 yes, it's working with 2.24.0. We are taking about >= 2.25.0

Right. As per the original issue on moment people are still confirming that the issue persists. If you need an immediate workaround you'd have to downgrade moment.

Same problema here. Application with more than 2 thousands users along my country. I had to downgrade to version 2.24.

Fixed with moment version 2.25.3

hmm, don't see that yet in releases - https://github.com/moment/moment/releases

Just tried that 2.25.2 couple of hours ago and problem exists with that.

hmm, don't see that yet in releases - https://github.com/moment/moment/releases

Just tried that 2.25.2 couple of hours ago and problem exists with that.

You need to go to this link: https://www.npmjs.com/package/moment

hmm, don't see that yet in releases - https://github.com/moment/moment/releases
Just tried that 2.25.2 couple of hours ago and problem exists with that.

You need to go to this link: https://www.npmjs.com/package/moment

I always check GitHub releases first - which should be the same as npm - or any other package manager.

Just because usually things like update some package manager is done via CI which triggers on those GitHub tags - or that is what I've used and seen used in multiple different project.

Looking at other issues on moment - it looks like this is potentially fixed in 2.25.3? Again - if you are blocked and 2.25.3 does not fix your issue just install 2.24.0 alongside ngx-moment for the workaround.

Yes, fixed with moment v.2.25.3. You can close the issue.

v2.25.3 Fixed it for me

Yeah, I can also confirm that 2.25.3 fixed this issue, closing this one.