I bootstrapped my application with create-react-app and when I run my app it compiles with warnings and it throws errors on the browser.
Error while com
The reason this happens is because moment has released the new version from 2.24.0 to 2.25.0
Perform the following Steps to solve this issue :
Step 1: change the versions (In your case just add the "moment":"2.24.0" to your dependencies in your package.json since I don't see it present in your package.json)
"moment": "2.24.0",
"moment-timezone": "^0.5.28",
Step 2: If you are using yarn please add resolutions in your package.json file like this
"dependencies" {
"moment": "2.24.0",
"moment-timezone": "^0.5.28"
},
"resolutions": {
"moment": "2.24.0"
},
For more information about this issue go to https://github.com/moment/moment/issues/4505
Change in package.json :
"moment": "2.25.1",
to
"moment": "2.24.0",
then run on terminal: npm install
Just follow these steps:-
step 1: npm install --save-dev npm-force-resolutions
step 2: add in package.json
"resolutions": {
"moment": "2.24.0"
}
step 3: add in scripts in package.json
"preinstall": "npx npm-force-resolutions"
step 4: npm install
Moment Released new version that breaks application,
as in your case there is no moment in package.json, if you simply add this to your package
moment: "2.24.0"
and run npm install it will add this moment package and resolve your issue,
otherwise you can try this cammand
npm install --save --save-exact moment@2.24.0
it will automatically add this package to your package.json with this specific version
i hope this works for you
New moment 2.25.x versions have been released and the latest version should fix this issue.
It seems like the version 2.25.2 was addressing this issue. So a downgrade to 2.24.0 is not required anymore.