storybook
storybook copied to clipboard
Settings in nuxt.config.ts don't take effect
version
- nuxt 3.8.2
- @nuxtjs/storybook 7.0.0
nuxt.config.ts
modules: [
'@nuxtjs/storybook',
...
],
storybook: {
url: 'http://localhost:6006',
port: 6006,
},
...
What is expected
Storybook is started on port 6006 with the command pnpm dev --port 3001
What is happening
Storybook is started on port 3000 with the command pnpm dev --port 3001
What is wrong
The function getPort() from the package get-port-please takes a port option for the first port to check with a default value process.env.PORT || 3000. So the ports option in L12 will not be available. The following changes will work correctly。
const STORYBOOK_PORT = await getPort({ port: options.port, ports: [6006, 6007, 6008, 6009, 6010] });
https://github.com/unjs/get-port-please#port https://github.com/nuxt-modules/storybook/blob/5a7d614485fc055b03014d12d67d6fcd9c0fd43d/src/storybook.ts#L5 https://github.com/nuxt-modules/storybook/blob/5a7d614485fc055b03014d12d67d6fcd9c0fd43d/src/storybook.ts#L12
There is a PR for a temporary fix in this package here: https://github.com/nuxt-modules/storybook/pull/447 I have also submitted a fix to the get-port-please project here: https://github.com/unjs/get-port-please/pull/72 (If you want them to merge it quicker, a comment on the relevant issue may help: https://github.com/unjs/get-port-please/issues/67 )
As a work around, if you are using pnpm, you can add my PR as an override in your package.json. It would look something like this:
{
...
"pnpm": {
"overrides": {
"get-port-please": "github:filiphazardous/get-port-please",
Since https://github.com/unjs/get-port-please/pull/72 got merged now and we use the new version of get-port already, my understanding is that this bug is fixed. Thanks @filiphazardous!
If there are still issues, please let us know and we will reopen.