Skip to content
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

date-fns issue in 1.4.1 #79

Open
wkentdag opened this issue May 20, 2024 · 1 comment
Open

date-fns issue in 1.4.1 #79

wkentdag opened this issue May 20, 2024 · 1 comment

Comments

@wkentdag
Copy link

I just upgraded my Payload deps to the latest 2.x packages, including bumping this package from 1.3.5 to 1.4.1. After upgrading, I get the following error on start / any payload CLI command:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './format/index.js' is not defined by "exports" in /path/to/my/project/node_modules/date-fns/package.json
    at new NodeError (node:internal/errors:405:5)
    at exportsNotFound (node:internal/modules/esm/resolve:366:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:713:9)
    at resolveExports (node:internal/modules/cjs/loader:590:36)
    at Module._findPath (node:internal/modules/cjs/loader:664:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1126:27)
    at Module._load (node:internal/modules/cjs/loader:981:27)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/path/to/my/project/@nouance/payload-better-fields-plugin/node_modules/date-fns-tz/format/index.js:8:37) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

The import statement for date-fns-tz looks fine, so I'm wondering if the error could be due to the fact that I also have date-fns installed as a direct dependency?

with npm: 10.5.0, node: 18.20.2:

  "dependencies": {
    "@azure/storage-blob": "^12.17.0",
    "@nouance/payload-better-fields-plugin": "^1.4.1",
    "@payloadcms/bundler-webpack": "^1.0.6",
    "@payloadcms/db-postgres": "^0.8.4",
    "@payloadcms/plugin-cloud-storage": "^1.1.2",
    "@payloadcms/richtext-lexical": "^0.11.1",
    "cross-env": "^7.0.3",
    "date-fns": "^3.6.0",
    "express": "^4.17.1",
    "payload": "^2.18.3",
    "payload-plugin-algolia": "^0.1.0",
    "payload-plugin-scheduler": "^0.0.3"
  },

It turns out I don't need any of the new updates so I reverted to 1.3.5 and the issue's gone. Just posting here for posterity!

@dhatGuy
Copy link

dhatGuy commented Oct 16, 2024

This package uses date-fns-tz v2 which is not compatible with date-fns v3 and you have v3.6.0 installed.
I was able to fix this using resolutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants