keystonejs / keystone

The most powerful headless CMS for Node.js — built with GraphQL and React
https://keystonejs.com
MIT License
8.98k stars 1.13k forks source link

Cannot find module 'fp-ts/lib/Either' #9113

Open ttbarnes opened 2 months ago

ttbarnes commented 2 months ago

Hiya, i've bumped the following packages to the latest versions, with node version 21.6.2, NPM version 10.2.4:

"@keystone-6/auth": "^8.0.0",
"@keystone-6/core": "^6.0.0",
"@keystone-6/fields-document": "^9.0.0",

When running npm run dev, which has the following:

"keystone dev --no-ui",

I get the following error, Keystone cannot start:

> keystone dev  --no-ui

✨ Starting Keystone
(node:87386) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Error: Cannot find module 'fp-ts/lib/Either'
Require stack:
- /Users/tonyb/project/src/api/node_modules/io-ts/lib/index.js
- /Users/tonyb/project/src/api/node_modules/@keystone-6/fields-document/dist/validation-d47c8b80.cjs.dev.js
- /Users/tonyb/project/src/api/node_modules/@keystone-6/fields-document/dist/keystone-6-fields-document.cjs.dev.js
- /Users/tonyb/project/src/api/node_modules/@keystone-6/fields-document/dist/keystone-6-fields-document.cjs.js
- /Users/tonyb/project/src/api/.keystone/config.js
- /Users/tonyb/project/src/api/node_modules/@keystone-6/core/dist/createSystem-b211ce31.cjs.dev.js
- /Users/tonyb/project/src/api/node_modules/@keystone-6/core/scripts/cli/dist/keystone-6-core-scripts-cli.cjs.dev.js
- /Users/tonyb/project/src/api/node_modules/@keystone-6/core/scripts/dist/keystone-6-core-scripts.cjs.dev.js
- /Users/tonyb/project/src/api/node_modules/@keystone-6/core/scripts/dist/keystone-6-core-scripts.cjs.js
- /Users/tonyb/project/src/api/node_modules/@keystone-6/core/bin/cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1149:15)
    at /Users/tonyb/project/src/api/node_modules/next/dist/server/require-hook.js:54:36
    at Module._load (node:internal/modules/cjs/loader:990:27)
    at Module.require (node:internal/modules/cjs/loader:1237:19)
    at mod.require (/Users/tonyb/project/src/api/node_modules/next/dist/server/require-hook.js:64:28)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/Users/tonyb/project/src/api/node_modules/io-ts/lib/index.js:43:16)
    at Module._compile (node:internal/modules/cjs/loader:1378:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1437:10)
    at Module.load (node:internal/modules/cjs/loader:1212:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/tonyb/project/src/api/node_modules/io-ts/lib/index.js',
    '/Users/tonyb/project/src/api/node_modules/@keystone-6/fields-document/dist/validation-d47c8b80.cjs.dev.js',
    '/Users/tonyb/project/src/api/node_modules/@keystone-6/fields-document/dist/keystone-6-fields-document.cjs.dev.js',
    '/Users/tonyb/project/src/api/node_modules/@keystone-6/fields-document/dist/keystone-6-fields-document.cjs.js',
    '/Users/tonyb/project/src/api/.keystone/config.js',
    '/Users/tonyb/project/src/api/node_modules/@keystone-6/core/dist/createSystem-b211ce31.cjs.dev.js',
    '/Users/tonyb/project/src/api/node_modules/@keystone-6/core/scripts/cli/dist/keystone-6-core-scripts-cli.cjs.dev.js',
    '/Users/tonyb/project/src/api/node_modules/@keystone-6/core/scripts/dist/keystone-6-core-scripts.cjs.dev.js',
    '/Users/tonyb/project/src/api/node_modules/@keystone-6/core/scripts/dist/keystone-6-core-scripts.cjs.js',
    '/Users/tonyb/project/src/api/node_modules/@keystone-6/core/bin/cli.js'
  ]
}

Seems to be an issue relating to io-ts.

How can this be resolved please?

dcousens commented 2 months ago

Are you using io-ts or fp-ts in your project?

ttbarnes commented 2 months ago

Are you using io-ts or fp-ts in your project?

Thanks for the quick response @dcousens - not specifically, seem to be dependencies within Keystone:

npm ls io-ts
api@1.0.0
└─┬ @keystone-6/fields-document@8.0.2
  ├─┬ io-ts-excess@1.0.1
  │ └── io-ts@2.2.21 deduped
  └── io-ts@2.2.21

npm ls fp-ts
api@1.0.0
├─┬ @keystone-6/core@5.8.0
│ ├─┬ @prisma/internals@4.16.2
│ │ └── fp-ts@2.16.0
│ └─┬ @prisma/migrate@4.16.2
│   └── fp-ts@2.16.0 deduped
└─┬ @keystone-6/fields-document@8.0.2
  ├─┬ io-ts-excess@1.0.1
  │ └── fp-ts@2.16.0 deduped
  └─┬ io-ts@2.2.21
    └── fp-ts@2.16.0 deduped
vishalkumar-activelabs commented 2 months ago

image

I am facing similar issue.

@ttbarnes Found any solutions?

ttbarnes commented 2 months ago

image

I am facing similar issue.

@ttbarnes Found any solutions?

Unfortunately not 😢

galloppinggryphon commented 2 months ago

Further to @ttbarnes, previous release of @keystone-6/fields-document (8.0.2, if I'm not mistaken) complained about missing correct versions of fp-ts:

// yarn add @keystone-6/core@5.8.0 @keystone-6/auth@7.0.3 @keystone-6/fields-document@8.0.2
warning "@keystone-6/fields-document > io-ts@2.2.21" has unmet peer dependency "fp-ts@^2.5.0".
warning "@keystone-6/fields-document > io-ts-excess@1.0.1" has unmet peer dependency "fp-ts@^2.0.0".

Looking forward to a fix.

dcousens commented 2 months ago

I think potentially we need to add fp-ts as a peer dependency to the @keystone-6/fields-document package - pull requests accepted!