GithubHelp home page GithubHelp logo

Upgrade from date-fns 2.30 to 3.0.6: Cannot find module 'date-fns/format/index.js' from 'node_modules/date-fns-tz/format/index.js' about date-fns-tz HOT 5 CLOSED

ningji avatar ningji commented on May 23, 2024 29
Upgrade from date-fns 2.30 to 3.0.6: Cannot find module 'date-fns/format/index.js' from 'node_modules/date-fns-tz/format/index.js'

from date-fns-tz.

Comments (5)

philios33 avatar philios33 commented on May 23, 2024 12

The problem is that npm reads dependencies from the package.json file, not from the README. Try to install this package in a fresh project and you will see it installs date-fns v3 instead of v2 because it thinks it supports it. There are already 2 PRs for this. 1 has been approved, but v2.0.0 is still the latest published version on npm. Not sure on the timelines

from date-fns-tz.

TakashiAihara avatar TakashiAihara commented on May 23, 2024 2

To work around dependency issues, here's how you can adjust your package.json:

For npm

Fix the version of date-fns in your dependencies to the latest minor version of v2.

{
  ...
  "overrides": {
    "date-fns": "2.x"
  }
}

For yarn

Install date-fns directly as Yarn requires this dependency resolution.

{
  ...
  "dependencies": {
    "date-fns": "2.x"
  }
}

For pnpm

Conform to pnpm's method by fixing the date-fns in your dependencies to v2.

{
  ...
  "pnpm": {
    "overrides": {
      "date-fns": "2.x"
    }
  }
}

from date-fns-tz.

Deanmv avatar Deanmv commented on May 23, 2024

Duplicate of #260

from date-fns-tz.

philios33 avatar philios33 commented on May 23, 2024

Somebody has tried to fix it here:
#262

and there is a PR to upgrade to v3 of date-fns which will probably be released soon. But yeah, ultimately this package is now broken since 18th Dec when v3 came out.

Your options are:

  1. Downgrade
  2. Fix it
  3. Wait

from date-fns-tz.

jeslenbucci avatar jeslenbucci commented on May 23, 2024

But yeah, ultimately this package is now broken since 18th Dec when v3 came out.

The package isn't broken. It's just not compatible with v3. The first sentence of the repo clearly states in the readme (which hasn't been updated since last year): 'Time zone support for date-fns v2.0.0'. The package continues to function properly with the version of date-fns is was built for.

from date-fns-tz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.