New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TS2307: Cannot find module 'moment'. #5486
Comments
try version 2.24, my tests started to fail on new version but fine with previous |
I have tried. but same error came. |
what does the line for moment in package.json look like? |
its working with 2.24.0 may be deployment error in 2.25.0 |
if you use yarn, add resolutions block to package.json to override versions of sub-dependency, it work for me
|
Seems that Typescript module resolution can't find moment. Using a relative path works ./node_modules/moment/moment. @codebrent Thanks, it's now working with 2.24.0 version. |
In 2.25 this has been added to package.json. But if I understand no corresponding location exists for the typedef file. Perhaps this broke the typings? "typesVersions": {
">=3.1": {
"*": [
"ts3.1-typings/*"
]
}
}, |
No its not working for me |
"moment": "^2.25.0", |
try changing to "moment": "2.24.0", make sure that there isn't a ^ in it. delete node_models and re npm install. also if you have package-lock.json you may need to delete it. Otherwise npm will keep installing 2.25 |
I'm seeing the same issue, and according to the Dependabot Compatibility score for moment, I'm not the only one. Downgrading to 2.24.0 may be a a work-around, but it effectively prevents at least some users from using 2.25.0. |
The safer, canonical way to do this is simply I can confirm that downgrading to 2.24 fixes the issue. |
I can confirm 2.25.0 give this issue but not at 2.24.0. |
I also confirm that 2.25.0 give this issue. Moment 2.24.0 works fine. I experienced this problem during docker image build. |
its not working with 2.24.0 for me |
Downgrading fixed the issue here too. Maybe the TypeScript version may play a role in having the bug or not? |
I use moment-timezone |
you probably did not downgrade to 2.24.0. Remove your package-lock file and node_modules folder, then run this command :
|
I'm also experiencing the same issue in a typescript project and the build is failing all of a sudden because we didn't pin the dependency in package.json.
pinning the version to |
Can try with resolutions field in package.json Add
|
I also confirm that with 2.25.0 I have the same issue with typescript 3.8.3 and running with ts-node 8.9.1. Downgrading to 2.24.0 solved the problem. |
"moment": "2.24.0" is working for me also.. |
Same, locking in 2.24.0 fixed it. This is on an angular 7.2 app built with webpack ^4.2.0 |
Yes, 2.24.0 is working fine. Does anyone know what is the change they've made? |
Same, issue got fixed by setting fixed version to "2.24" instead of "^2.24" |
Do we have an ETA for this fix? It's Friday and I am wondering if I should downgrade to 2.24.0 before the weekend. |
You are no longer living in the moment though :) |
Thanks, Issue got fixed by downgrading version from 2.25.0 to 2.24.0. Also I did "^2.24.0" to "2.24.0" |
If the downgrade von Using npm:
Hope it helps. Cheers |
Any Idea when the fix will be released ? I see this is a broken issue and I don't have access to make changes in Master to set the moment version to 2.24 now and production builds is failing left and right. |
I had this issue also, and i fixed it |
this will work locally, but for CI pipelines, I doubt |
Thanks everyone :D 2.24.0 worked for me as well.. |
Downgraded to |
2.25.1 released |
Tested 2.25.1 , issue is gone. Thanks |
Yeah, I tested this too and didn't experience any issues. |
Indeed, upgraded minutes after it was published and all is well: thanks for the speedy fix! |
version 2.25.1 solved the Cannot find module 'moment' problem, but I am testing in an Angular 8 application and it throws the following error:
has anyone else experienced this failure? |
I'm also getting warnings in 2.25.1 about some of the other functions I'm referencing:
|
For me it was
|
I think you can update moment to version 2.29.0
|
npm install moment --save |
|
I m having issue with importing moment in to my angular 8 project.
Angular version = 8.3.26
Type script version = 3.6.2
moment version = 2.25.0
i'm getting error TS2307: Cannot find module 'moment'. and i have used
import moment from 'moment'; .
i have add "moduleResolution": "node" and "allowSyntheticDefaultImports": true, in tsConfig
can any one help on this
The text was updated successfully, but these errors were encountered: