keystone
keystone copied to clipboard
Customer Admin UI Logo Example is broken
in the readme.md file here it seems that the code sandbox example is broken due to the following error:
✨ Starting Keystone
✘ [ERROR] Could not resolve "../example-utils"
keystone.ts:2:30:
2 │ import { fixPrismaPath } from '../example-utils';
╵ ~~~~~~~~~~~~~~~~~~
Error: Cannot find module '/project/sandbox/.keystone/config.js'
Require stack:
- /project/sandbox/node_modules/@keystone-6/core/dist/artifacts-ad26eee3.cjs.dev.js
- /project/sandbox/node_modules/@keystone-6/core/scripts/cli/dist/keystone-6-core-scripts-cli.cjs.dev.js
- /project/sandbox/node_modules/@keystone-6/core/scripts/dist/keystone-6-core-scripts.cjs.dev.js
- /project/sandbox/node_modules/@keystone-6/core/scripts/dist/keystone-6-core-scripts.cjs.js
- /project/sandbox/node_modules/@keystone-6/core/bin/cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at /project/sandbox/node_modules/next/dist/server/require-hook.js:110:36
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.getBuiltKeystoneConfiguration (/project/sandbox/node_modules/@keystone-6/core/dist/artifacts-ad26eee3.cjs.dev.js:365:28)
at dev (/project/sandbox/node_modules/@keystone-6/core/scripts/cli/dist/keystone-6-core-scripts-cli.cjs.dev.js:886:42)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/project/sandbox/node_modules/@keystone-6/core/dist/artifacts-ad26eee3.cjs.dev.js',
'/project/sandbox/node_modules/@keystone-6/core/scripts/cli/dist/keystone-6-core-scripts-cli.cjs.dev.js',
'/project/sandbox/node_modules/@keystone-6/core/scripts/dist/keystone-6-core-scripts.cjs.dev.js',
'/project/sandbox/node_modules/@keystone-6/core/scripts/dist/keystone-6-core-scripts.cjs.js',
'/project/sandbox/node_modules/@keystone-6/core/bin/cli.js'
]
}
error Command failed with exit code 1.
It seems the blog example is broken as well https://githubbox.com/keystonejs/keystone/tree/main/examples/usecase-blog
The "Example Project: Authentication" link here at the bottom also returns 404 (not very sure if this is related with the issue) https://github.com/keystonejs/keystone/tree/main/examples/with-auth
I have this example working on my local. However, unfortunately, I had to workaround this problem. TO get the example to work, I had 2 issues: Both imports below were not resolved correctly
- import type { Lists } from '.keystone/types'
- import { fixPrismaPath } from '../example-utils'
I found example-utils in the example root folder I found the types file in node_modules/.keystone folder
I made sure that these files were in a location that was resolved and the example ended up working.
@digitalrisedorset are you running the example from within the example folder? :confused:
@digitalrisedorset are you running the example from within the example folder? 😕
That is how I started the experiment (apologies, I am new to keystone). Since it was failing and I had no experience to troubleshoot it, I tried various situations.. Once I got it working, I realised that both these files were the culprit. I have looked at resolving the issue in the monorepo. Since I saw your comment, I thought I'd mention my findings in case someone has more ideas as to what is not right in the monorepo
Hi @TheMikeyRoss I have tried again the monorepo today. To setup an example/use case, we have 2 steps: pnpm install and pnpm dev. I was doing the first step in the example folder whilst it should be run from the monorepo root folder (it is written but somehow I missed the word root). Once pnpm install is successful at the root pnpm dev on either subfolder from the example folder launch the example with no issue
@digitalrisedorset are you running the example from within the example folder? 😕
thanks for replying, I was indeed running from the example. Now, I only run one command from the example folder and the other from the root as per the README recommendations
Ah yup, you need to pnpm install from the monorepo root, and then use pnpm dev inside the examples.
If the documentation wording could be improved any, please make a pull request! :yellow_heart: