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?
I just upgraded my Payload deps to the latest 2.x packages, including bumping this package from
1.3.5
to1.4.1
. After upgrading, I get the following error on start / anypayload
CLI command: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 havedate-fns
installed as a direct dependency?with npm: 10.5.0, node: 18.20.2:
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!