Error: Can't resolve 'date-fns/format'

See original GitHub issue

Why am I getting:

Module not found: Error: Can’t resolve ‘date-fns/format’

after installing date-fns like this: npm install date-fns --save

I am requiring it like this: const format = require('date-fns/format');

I can see this in my package.json file: "dependencies": { "date-fns": "^1.29.0" }

and I can also see the module in node_modules

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
kossnocorpcommented, Nov 14, 2018

I believe that’s unrelated to date-fns. However please make sure that format is there (see a snippet below) and you require it from a file that has access to node_modules.

$ ls node_modules/date-fns/format/ | grep index.js
index.js
index.js.flow
2reactions
marcosfsjcommented, Jul 31, 2019

I just got the same error!

It never happened before and I am using the latest versions of both, npm and node.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found: Can't resolve '@date-io/date-fns'
I'm using React Material UI and I get this error : Module not found: Can't resolve '@date-io/date-fns'. Here are the dependencies that I...
Read more >
Module not found: Can't resolve '@date-io/date-fns' | bobbyhadz
To solve the error "Module not found: Error: Can't resolve '@date-io/date-fns'", make sure to install the package by opening your terminal in your...
Read more >
date-fns - npm
date -fns provides the most comprehensive, yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js.
Read more >
Can't resolve 'date-fns/_lib/format/longFormatters'
can't resolve 'date-fns/_lib/format/longformatters'. Add Answer | View In TPC Matrix. Technical Problem Cluster First Answered On July 12, 2021 Popularity ...
Read more >
date-fns | Yarn - Package Manager
This project adheres to Semantic Versioning. This change log follows the format documented in Keep a CHANGELOG. v2.29.3 - 2022-09-13. This release is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found