urish / ngx-moment

moment.js pipes for Angular
MIT License
1.17k stars 154 forks source link

Problems with moment 2.25.0 #235

Closed tarlepp closed 4 years ago

tarlepp commented 4 years ago

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:

nickyg91 commented 4 years ago

Looks like this issue is actually caused by moment itself. See https://github.com/moment/moment/issues/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.

adamdport commented 4 years ago

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.

nickyg91 commented 4 years ago

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

mhosman commented 4 years ago

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

nickyg91 commented 4 years ago

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

mhosman commented 4 years ago

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

nickyg91 commented 4 years ago

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.

ludufre commented 4 years ago

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

mhosman commented 4 years ago

Fixed with moment version 2.25.3

tarlepp commented 4 years ago

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.

mhosman commented 4 years ago

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

tarlepp commented 4 years ago

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.

nickyg91 commented 4 years ago

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.

mhosman commented 4 years ago

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

ruspaull commented 4 years ago

v2.25.3 Fixed it for me

tarlepp commented 4 years ago

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