Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
363 views
in Technique[技术] by (71.8m points)

javascript - Create-React-App with Moment JS: Cannot find module "./locale"

Just ran an npm update on my web application and now Moment JS appears to be failing with the following message:

Error: Cannot find module "./locale"

ode_modulesmomentsrclibmomentprototype.js:1
> 1 | import { Moment } from './constructor';

Not sure what version of Moment JS I had prior to my update, but my application has been working for months.

I created another react app and ran an npm install moment --save and modified the source to display the time and ended up with the same error described above.

Not sure if there is a fail-proof way to integrate Moment JS using Create-React-App currently short of ejecting to manage the webpack settings myself, but I really don't want to do this. Anyone else seeing these issues or having success? If so, a short write up would go along way to helping out.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Appears this has already been identified as an issue for Moment JS version 2.19. If you have upgraded to 2.19 run npm install [email protected] to revert back to previous version until it is fixed!

See thread: https://github.com/moment/moment/issues/4216


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...