Describe the bug
When I build my React application, the build fails with an error.
./node_modules/moment/src/lib/locale/locales.js
Module not found: Can't resolve './locale' in '/Users/raravi/Programming/gitprojects/sudoku/node_modules/moment/src/lib/locale'
To Reproduce
Steps to reproduce the behavior:
npm start
in the terminalExpected behavior
The React application should build without any errors from moment.
Desktop (please complete the following information):
Moment-specific environment
Please run the following code in your environment and include the output:
console.log((new Date()).toString())
Wed May 06 2020 03:57:24 GMT+0200 (Central European Summer Time)
console.log((new Date()).toLocaleString())
06/05/2020, 03:57:24
console.log((new Date()).getTimezoneOffset())
-120
console.log(navigator.userAgent)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36
console.log(moment.version)
2.25.1
We are having very similar problem since yesterday. Nothing changed on our end but the release of moment-2.25.2
. We know see warnings like
WARNING in ./node_modules/moment/src/lib/locale/locales.js
Module not found: Error: Can't resolve './locale' in '/app/node_modules/moment/src/lib/locale'
@ ./node_modules/moment/src/lib/locale/locales.js
@ ./node_modules/moment/src/lib/locale/locale.js
@ ./node_modules/moment/src/moment.js
The real problem is our UI generates a lot of errors
I come back to version 2.24.0 to fix this error
@Jerome2606 I've done the same, for now.
I have the same issue with my vue app. Also moved back to. 2.24.x
I used moment @ 2.25.3
without warning.
I'm using NextJS
and I had to downgrade to 2.24.0
because I was not able to load other locales.
I tried almost everything with the require("/moment/locale/xxx")
and the webpack plugin ContextReplacementPlugin
from this example. I don't see any errors but it just does not load with this code :
javascript
moment.locale(lang);
momentTZ.updateLocale(lang, moment.localeData()._config);
momentTZ.locale(lang);
Seems to work well in 2.25.3
Closing this issue, it's fixed in v2.25.3
!
Most helpful comment
I have the same issue with my vue app. Also moved back to. 2.24.x