Issue with running Storybook project from Sanity examples directory.
17 replies
Last updated: May 8, 2021
F
Hi, I'm trying to run the Storybook project from the Sanity examples directory (https://github.com/sanity-io/sanity/tree/next/examples/storybook ). After installing all dependencies (tried
lerna bootstrapand
npmas well as
yarn), and starting the server, I get many Module not found: Error: Can't resolve
@sanity/related errors - at least 32 of them - even if the dependencies seem to be installed correctly.
May 8, 2021, 12:06 PM
F
After running
lerna bootstrapfrom the root of the repo, I try to start the app, but get this error:
storybook % npm start > storybook@2.10.2 start > sanity start --port 9002 @sanity/core not installed in current project Project-specific commands not available until you run `sanity install` Error: "start" is not available outside of a Sanity project context. Run the command again within a Sanity project directory, where "@sanity/core" is installed as a dependency.
May 8, 2021, 12:07 PM
F
Even though
node_modules/@sanity/coreis installed - I can see it being there. I continue as suggested above:
storybook % sanity install ✖ Resolving dependencies Fetching packages ✖ An unexpected error occurred: "ENOENT: no such file or directory, lstat '/Users/fabien/Development/sanity/sanity-development/examples/storybook/node_modules/@sanity/base/node_modules/polished/node_modules'". ✖ Resolving dependenciesinking dependencies Error: Command failed :(
May 8, 2021, 12:09 PM
F
Proceeding with
Followed by numerous
errors.
npm iand running
sanity installonce again, I can finally start the server:
⠦ Compiling...Storybook listening on <http://localhost:9001/> ⠙ Compiling...webpack built d1935283b7fceb260a1a in 7327ms ✔ Compiling... Failed to compile.
Module not found: Error: Can't resolve ...
May 8, 2021, 12:11 PM
G
I got this working with
yarnfollowed by
sanity start. Perhaps give that a try with a clean version of the directory?
May 8, 2021, 2:49 PM
F
Hi Geoff, did you run
lerna bootstrapfirst?
May 8, 2021, 2:50 PM
G
No. I don’t have lerna installed globally and don’t see it anywhere in the package.
May 8, 2021, 2:50 PM
F
Unfortunately, no success. I deleted
node_modulesand
package-lock.jsonand
yarn.lock.
May 8, 2021, 2:56 PM
G
What’s the latest error now? Is it when running
yarnor
sanity start?
May 8, 2021, 3:19 PM
G
What’s the latest error now? Is it when running
yarnor
sanity start?
May 8, 2021, 3:19 PM
F
Still all the compilation errors due to missing dependencies (so after
sanity start)
May 8, 2021, 3:28 PM
F
Still all the compilation errors due to missing dependencies (so after
sanity start)
May 8, 2021, 3:28 PM
G
Sorry Fabien. I tried different versions of node and yarn and couldn’t replicate the error.
May 8, 2021, 3:36 PM
F
That's odd - thanks for checking this. I'm on Node
v14.15.0. Did you simply clone the full repo and go to that directory and ran
yarn?
May 8, 2021, 3:38 PM
G
I tried on 14.16.1, 15.12.0, and 16.1.0. I downloaded the whole sanity repo then pulled out the storybook folder and worked on it in isolation.
May 8, 2021, 3:45 PM
F
Let me try that in isolation - I have a feeling that this lerna thing is still causing havoc here.
May 8, 2021, 3:46 PM
F
Sure enough, it's now working (pulled it from a zip file of the repo). Thanks for all your help!
May 8, 2021, 3:51 PM
G
Nice! Glad to hear it.
May 8, 2021, 3:54 PM
Sanity– build remarkable experiences at scale
Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.