I'm trying to use Storybook with the wait-on npm package: https://www.npmjs.com/package/wait-on
When I run the wait-on command I get the error:
Error: ENOENT: no such file or directory, stat '<path to my project>/node_modules/@storybook/core/dist/server/public/index.html'
at Error (native)
And I don't even have or use the storybook/core package. Do you know why it is searching for this file?
These are the @storybook packages I'm using:
And after I installed storybook/core I still got the error. I also removed node_modules and ran yarn again with no luck.
These are the commands I run to induce the issue:
"storybook": "start-storybook -p 6006",
"cypress:test": "wait-on http://localhost:6006 && cypress run",
"test": "concurrently 'npm run storybook' 'npm run cypress:test' "
I get the error if I run the test command or if I run first:
npm run storybook
And then:
npm run cypress:test
So basically by using the wait-on package, Storybook searches for this file:
That indeed doesn't exists.
According to the docs:
wait-on http://localhost:8000/foo && NEXT_CMD # wait for http 2XX HEAD
Using wait-on with the http:xxxx trys to access with a HEAD method to the server, which is not supported in storybook (there is only a get command implemented). I've tested it with http-get instead and it did work for me.
wait-on http-get://localhost:8000/foo && NEXT_CMD # wait for http 2XX GET
Most helpful comment
According to the docs:
Using
wait-onwith the http:xxxx trys to access with aHEADmethod to the server, which is not supported in storybook (there is only agetcommand implemented). I've tested it withhttp-getinstead and it did work for me.