keystone icon indicating copy to clipboard operation
keystone copied to clipboard

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

Open ttbarnes opened this issue 1 year ago • 6 comments

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?

ttbarnes avatar Apr 24 '24 09:04 ttbarnes

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

dcousens avatar Apr 24 '24 12:04 dcousens

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
[email protected]
└─┬ @keystone-6/[email protected]
  ├─┬ [email protected]
  │ └── [email protected] deduped
  └── [email protected]


npm ls fp-ts
[email protected]
├─┬ @keystone-6/[email protected]
│ ├─┬ @prisma/[email protected]
│ │ └── [email protected]
│ └─┬ @prisma/[email protected]
│   └── [email protected] deduped
└─┬ @keystone-6/[email protected]
  ├─┬ [email protected]
  │ └── [email protected] deduped
  └─┬ [email protected]
    └── [email protected] deduped

ttbarnes avatar Apr 24 '24 13:04 ttbarnes

image

I am facing similar issue.

@ttbarnes Found any solutions?

vishalkumar-activelabs avatar Apr 25 '24 13:04 vishalkumar-activelabs

image

I am facing similar issue.

@ttbarnes Found any solutions?

Unfortunately not 😢

ttbarnes avatar Apr 25 '24 13:04 ttbarnes

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/[email protected] @keystone-6/[email protected] @keystone-6/[email protected]
warning "@keystone-6/fields-document > [email protected]" has unmet peer dependency "fp-ts@^2.5.0".
warning "@keystone-6/fields-document > [email protected]" has unmet peer dependency "fp-ts@^2.0.0".

Looking forward to a fix.

galloppinggryphon avatar Apr 25 '24 17:04 galloppinggryphon

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

dcousens avatar Apr 26 '24 00:04 dcousens

I couldn't replicate the error, but I've added in #9261 and verified that it now shows as a dep by running pnpm ls in packages/fields-document

kennedybaird avatar Aug 06 '24 01:08 kennedybaird

Fixed in https://github.com/keystonejs/keystone/pull/9263

dcousens avatar Aug 06 '24 06:08 dcousens

Amazing thank you @dcousens 🎉

ttbarnes avatar Aug 06 '24 12:08 ttbarnes