storybook-vue / storybook-nuxt

Deprecated in favor of https://github.com/nuxt-modules/storybook/
https://github.com/nuxt-modules/storybook/
133 stars 20 forks source link

WARN Failed to load preset: "@storybook-vue/nuxt/preset" #2

Open jojomatik opened 1 year ago

jojomatik commented 1 year ago

After switching to this package in my project, I receive the following error.

WARN   Failed to load preset: "@storybook-vue/nuxt/preset"
ERR! Error: Cannot find module '/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook-vue/nuxt/dist/preset.js'
ERR!     at createEsmNotFoundErr (node:internal/modules/cjs/loader:1098:15)
ERR!     at finalizeEsmResolution (node:internal/modules/cjs/loader:1091:15)
ERR!     at resolveExports (node:internal/modules/cjs/loader:567:14)
ERR!     at Module._findPath (node:internal/modules/cjs/loader:[63](https://github.com/jojomatik/nuxt-3-base/actions/runs/5685029360/job/15409035368#step:7:64)6:31)
ERR!     at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
ERR!     at Module._resolveFilename (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/esbuild-register/dist/node.js:4768:36)
ERR!     at Module._load (node:internal/modules/cjs/loader:922:27)
ERR!     at Module.require (node:internal/modules/cjs/loader:1143:19)
ERR!     at require (node:internal/modules/cjs/helpers:110:18)
ERR!     at interopRequireDefault (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook/core-common/dist/index.js:6:21)
ERR!  Error: Cannot find module '/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook-vue/nuxt/dist/preset.js'
ERR!     at createEsmNotFoundErr (node:internal/modules/cjs/loader:1098:15)
ERR!     at finalizeEsmResolution (node:internal/modules/cjs/loader:1091:15)
ERR!     at resolveExports (node:internal/modules/cjs/loader:567:14)
ERR!     at Module._findPath (node:internal/modules/cjs/loader:636:31)
ERR!     at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
ERR!     at Module._resolveFilename (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/esbuild-register/dist/node.js:4768:36)
ERR!     at Module._load (node:internal/modules/cjs/loader:922:27)
ERR!     at Module.require (node:internal/modules/cjs/loader:1143:19)
ERR!     at require (node:internal/modules/cjs/helpers:110:18)
ERR!     at interopRequireDefault (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook/core-common/dist/index.js:6:21) {
ERR!   code: 'MODULE_NOT_FOUND',
ERR!   path: '/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook-vue/nuxt/package.json'
ERR! }
ERR! Error: no builder configured!
ERR!     at getPreviewBuilder (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook/core-server/dist/index.js:57:1918)
ERR!     at getBuilders (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook/core-server/dist/index.js:57:2221)
ERR!     at async buildStaticStandalone (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook/core-server/dist/index.js:103:1540)
ERR!     at async withTelemetry (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook/core-server/dist/index.js:113:3[65](https://github.com/jojomatik/nuxt-3-base/actions/runs/5685029360/job/15409035368#step:7:66)9)
ERR!     at async build (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook/cli/dist/generate.js:435:1059)
ERR!     at async Command.<anonymous> (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook/cli/dist/generate.js:438:125)
ERR!  Error: no builder configured!
ERR!     at getPreviewBuilder (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook/core-server/dist/index.js:57:1[91](https://github.com/jojomatik/nuxt-3-base/actions/runs/5685029360/job/15409035368#step:7:92)8)
ERR!     at getBuilders (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook/core-server/dist/index.js:57:2221)
ERR!     at async buildStaticStandalone (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook/core-server/dist/index.js:103:1540)
ERR!     at async withTelemetry (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook/core-server/dist/index.js:113:3659)
ERR!     at async build (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook/cli/dist/generate.js:435:1059)
ERR!     at async Command.<anonymous> (/home/runner/work/nuxt-3-base/nuxt-3-base/node_modules/@storybook/cli/dist/generate.js:438:125)

See also this PR https://github.com/jojomatik/nuxt-3-base/pull/273 and workflow https://github.com/jojomatik/nuxt-3-base/actions/runs/5685029360/job/15409035368

chakAs3 commented 1 year ago

@jojomatik I will fix that, thank you for reporting it

chakAs3 commented 1 year ago

@jojomatik can test again to close this issue ?

g1ronn1mo commented 1 year ago

I still have this error

pnpm storybook ─╯


> @ storybook C:\Users\benes\Scripts\nuxt3-frontend-webapp
> storybook dev -p 6006

@storybook/cli v7.1.1

WARN   Failed to load preset: "@storybook-vue\\nuxt\\preset"
ERR! C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\github.com+storybook-vue+nuxt@a647f44614e67f94da6877d381a9435abcb8ed48_@types+node@18.17.1_@v_zlfnxkqenwxpupllcibsyi4zou\node_modules\@storybook-vue\nuxt\src\preset.ts:2
ERR! import { join } from 'path';
ERR! ^^^^^^
ERR!
ERR! SyntaxError: Cannot use import statement outside a module
ERR!     at Object.compileFunction (node:vm:360:18)
ERR!     at wrapSafe (node:internal/modules/cjs/loader:1088:15)
ERR!     at Module._compile (node:internal/modules/cjs/loader:1123:27)
ERR!     at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
ERR!     at Object.newLoader [as .ts] (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\esbuild-register@3.4.2_esbuild@0.18.17\node_modules\esbuild-register\dist\node.js:2262:9)
ERR!     at Module.load (node:internal/modules/cjs/loader:1037:32)
ERR!     at Module._load (node:internal/modules/cjs/loader:878:12)
ERR!     at Module.require (node:internal/modules/cjs/loader:1061:19)
ERR!     at require (node:internal/modules/cjs/helpers:103:18)
ERR!     at Object.<anonymous> (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\github.com+storybook-vue+nuxt@a647f44614e67f94da6877d381a9435abcb8ed48_@types+node@18.17.1_@v_zlfnxkqenwxpupllcibsyi4zou\node_modules\@storybook-vue\nuxt\preset.js:1:18)
ERR!  C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\github.com+storybook-vue+nuxt@a647f44614e67f94da6877d381a9435abcb8ed48_@types+node@18.17.1_@v_zlfnxkqenwxpupllcibsyi4zou\node_modules\@storybook-vue\nuxt\src\preset.ts:2
ERR! import { join } from 'path';
ERR! ^^^^^^
ERR!
ERR! SyntaxError: Cannot use import statement outside a module
ERR!     at Object.compileFunction (node:vm:360:18)
ERR!     at wrapSafe (node:internal/modules/cjs/loader:1088:15)
ERR!     at Module._compile (node:internal/modules/cjs/loader:1123:27)
ERR!     at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
ERR!     at Object.newLoader [as .ts] (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\esbuild-register@3.4.2_esbuild@0.18.17\node_modules\esbuild-register\dist\node.js:2262:9)
ERR!     at Module.load (node:internal/modules/cjs/loader:1037:32)
ERR!     at Module._load (node:internal/modules/cjs/loader:878:12)
ERR!     at Module.require (node:internal/modules/cjs/loader:1061:19)
ERR!     at require (node:internal/modules/cjs/helpers:103:18)
ERR!     at Object.<anonymous> (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\github.com+storybook-vue+nuxt@a647f44614e67f94da6877d381a9435abcb8ed48_@types+node@18.17.1_@v_zlfnxkqenwxpupllcibsyi4zou\node_modules\@storybook-vue\nuxt\preset.js:1:18)
WARN Could not resolve addon "storybook-addon-nuxt", skipping. Is it installed?
ERR! Error: no builder configured!
ERR!     at getPreviewBuilder (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+core-server@7.1.1\node_modules\@storybook\core-server\dist\index.js:57:1918)
ERR!     at buildDevStandalone (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+core-server@7.1.1\node_modules\@storybook\core-server\dist\index.js:128:1888)
ERR!     at async withTelemetry (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+core-server@7.1.1\node_modules\@storybook\core-server\dist\index.js:113:3725)
ERR!     at async dev (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+cli@7.1.1\node_modules\@storybook\cli\dist\generate.js:457:401)
ERR!     at async Command.<anonymous> (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+cli@7.1.1\node_modules\@storybook\cli\dist\generate.js:459:225)
ERR!  Error: no builder configured!
ERR!     at getPreviewBuilder (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+core-server@7.1.1\node_modules\@storybook\core-server\dist\index.js:57:1918)
ERR!     at buildDevStandalone (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+core-server@7.1.1\node_modules\@storybook\core-server\dist\index.js:128:1888)
ERR!     at async withTelemetry (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+core-server@7.1.1\node_modules\@storybook\core-server\dist\index.js:113:3725)
ERR!     at async dev (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+cli@7.1.1\node_modules\@storybook\cli\dist\generate.js:457:401)
ERR!     at async Command.<anonymous> (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+cli@7.1.1\node_modules\@storybook\cli\dist\generate.js:459:225)

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

WARN Could not resolve addon "storybook-addon-nuxt", skipping. Is it installed?
 ELIFECYCLE  Command failed with exit code 1.
╭─    ~\Scripts\nuxt3-frontend-webapp    main ≡  ?1 ~18 -1                                            18.12.1   11.065s   14:17:48  ─╮ 
╰─ pnpm storybook                                                                                                                                   ─╯ 

> @ storybook C:\Users\benes\Scripts\nuxt3-frontend-webapp
> storybook dev -p 6006

@storybook/cli v7.1.1

WARN   Failed to load preset: "@storybook-vue\\nuxt\\preset"
ERR! Error: Cannot find module './dist/preset'
ERR! Require stack:
ERR! - C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\github.com+storybook-vue+nuxt@a647f44614e67f94da6877d381a9435abcb8ed48_@types+node@18.17.1_@v_zlfnxkqenwxpupllcibsyi4zou\node_modules\@storybook-vue\nuxt\preset.js
ERR! - C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+core-common@7.1.1\node_modules\@storybook\core-common\dist\index.js  
ERR! - C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+telemetry@7.1.1\node_modules\@storybook\telemetry\dist\index.js      
ERR! - C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+cli@7.1.1\node_modules\@storybook\cli\dist\generate.js
ERR! - C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+cli@7.1.1\node_modules\@storybook\cli\bin\index.js
ERR! - C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\storybook@7.1.1\node_modules\storybook\index.js
ERR!     at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
ERR!     at Module._resolveFilename (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\esbuild-register@3.4.2_esbuild@0.18.17\node_modules\esbuild-register\dist\node.js:4768:36)
ERR!     at Module._load (node:internal/modules/cjs/loader:841:27)
ERR!     at Module.require (node:internal/modules/cjs/loader:1061:19)
ERR!     at require (node:internal/modules/cjs/helpers:103:18)
ERR!     at Object.<anonymous> (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\github.com+storybook-vue+nuxt@a647f44614e67f94da6877d381a9435abcb8ed48_@types+node@18.17.1_@v_zlfnxkqenwxpupllcibsyi4zou\node_modules\@storybook-vue\nuxt\preset.js:1:18)
ERR!     at Module._compile (node:internal/modules/cjs/loader:1159:14)
ERR!     at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
ERR!     at Object.newLoader (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\esbuild-register@3.4.2_esbuild@0.18.17\node_modules\esbuild-register\dist\node.js:2262:9)
ERR!     at extensions..js (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\esbuild-register@3.4.2_esbuild@0.18.17\node_modules\esbuild-register\dist\node.js:4807:24)
ERR!  Error: Cannot find module './dist/preset'
ERR! Require stack:
ERR! - C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\github.com+storybook-vue+nuxt@a647f44614e67f94da6877d381a9435abcb8ed48_@types+node@18.17.1_@v_zlfnxkqenwxpupllcibsyi4zou\node_modules\@storybook-vue\nuxt\preset.js
ERR! - C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+core-common@7.1.1\node_modules\@storybook\core-common\dist\index.js  
ERR! - C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+telemetry@7.1.1\node_modules\@storybook\telemetry\dist\index.js      
ERR! - C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+cli@7.1.1\node_modules\@storybook\cli\dist\generate.js
ERR! - C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+cli@7.1.1\node_modules\@storybook\cli\bin\index.js
ERR! - C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\storybook@7.1.1\node_modules\storybook\index.js
ERR!     at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
ERR!     at Module._resolveFilename (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\esbuild-register@3.4.2_esbuild@0.18.17\node_modules\esbuild-register\dist\node.js:4768:36)
ERR!     at Module._load (node:internal/modules/cjs/loader:841:27)
ERR!     at Module.require (node:internal/modules/cjs/loader:1061:19)
ERR!     at require (node:internal/modules/cjs/helpers:103:18)
ERR!     at Object.<anonymous> (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\github.com+storybook-vue+nuxt@a647f44614e67f94da6877d381a9435abcb8ed48_@types+node@18.17.1_@v_zlfnxkqenwxpupllcibsyi4zou\node_modules\@storybook-vue\nuxt\preset.js:1:18)
ERR!     at Module._compile (node:internal/modules/cjs/loader:1159:14)
ERR!     at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
ERR!     at Object.newLoader (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\esbuild-register@3.4.2_esbuild@0.18.17\node_modules\esbuild-register\dist\node.js:2262:9)
ERR!     at extensions..js (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\esbuild-register@3.4.2_esbuild@0.18.17\node_modules\esbuild-register\dist\node.js:4807:24) {
ERR!   code: 'MODULE_NOT_FOUND',
ERR!   requireStack: [
ERR!     'C:\\Users\\benes\\Scripts\\nuxt3-frontend-webapp\\node_modules\\.pnpm\\github.com+storybook-vue+nuxt@a647f44614e67f94da6877d381a9435abcb8ed48_@types+node@18.17.1_@v_zlfnxkqenwxpupllcibsyi4zou\\node_modules\\@storybook-vue\\nuxt\\preset.js',
ERR!     'C:\\Users\\benes\\Scripts\\nuxt3-frontend-webapp\\node_modules\\.pnpm\\@storybook+core-common@7.1.1\\node_modules\\@storybook\\core-common\\dist\\index.js',
ERR!     'C:\\Users\\benes\\Scripts\\nuxt3-frontend-webapp\\node_modules\\.pnpm\\@storybook+telemetry@7.1.1\\node_modules\\@storybook\\telemetry\\dist\\index.js',
ERR!     'C:\\Users\\benes\\Scripts\\nuxt3-frontend-webapp\\node_modules\\.pnpm\\@storybook+cli@7.1.1\\node_modules\\@storybook\\cli\\dist\\generate.js',
ERR!     'C:\\Users\\benes\\Scripts\\nuxt3-frontend-webapp\\node_modules\\.pnpm\\@storybook+cli@7.1.1\\node_modules\\@storybook\\cli\\bin\\index.js',  
ERR!     'C:\\Users\\benes\\Scripts\\nuxt3-frontend-webapp\\node_modules\\.pnpm\\storybook@7.1.1\\node_modules\\storybook\\index.js'
ERR!   ]
ERR! }
ERR! Error: no builder configured!
ERR!     at getPreviewBuilder (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+core-server@7.1.1\node_modules\@storybook\core-server\dist\index.js:57:1918)
ERR!     at buildDevStandalone (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+core-server@7.1.1\node_modules\@storybook\core-server\dist\index.js:128:1888)
ERR!     at async withTelemetry (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+core-server@7.1.1\node_modules\@storybook\core-server\dist\index.js:113:3725)
ERR!     at async dev (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+cli@7.1.1\node_modules\@storybook\cli\dist\generate.js:457:401)
ERR!     at async Command.<anonymous> (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+cli@7.1.1\node_modules\@storybook\cli\dist\generate.js:459:225)
ERR!  Error: no builder configured!
ERR!     at getPreviewBuilder (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+core-server@7.1.1\node_modules\@storybook\core-server\dist\index.js:57:1918)
ERR!     at buildDevStandalone (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+core-server@7.1.1\node_modules\@storybook\core-server\dist\index.js:128:1888)
ERR!     at async withTelemetry (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+core-server@7.1.1\node_modules\@storybook\core-server\dist\index.js:113:3725)
ERR!     at async dev (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+cli@7.1.1\node_modules\@storybook\cli\dist\generate.js:457:401)
ERR!     at async Command.<anonymous> (C:\Users\benes\Scripts\nuxt3-frontend-webapp\node_modules\.pnpm\@storybook+cli@7.1.1\node_modules\@storybook\cli\dist\generate.js:459:225)

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

 ELIFECYCLE  Command failed with exit code 1.
 
 

g1ronn1mo commented 1 year ago

How did you install the package? I just run pnpm i storybook-vue/nuxt. Is this right?

g1ronn1mo commented 1 year ago

I had to upgrade to a newer nuxt version

├─┬ @storybook-vue/nuxt 0.1.0-alpha.3
│ └── ✕ unmet peer nuxt@^3.6.5: found 3.6.1

now npx storybook-nuxt init will try to install storybook-nuxt@7.2.1 but runs into an other error. npm ERR! code EUNSUPPORTEDPROTOCOL mentined here

jojomatik commented 1 year ago

Hi @chakAs3, sorry for the late reply. I was very involved in different projects over the last few months and didn't have a lot of time for my open source projects.

I've now tried to switch to version 0.0.8 but now I'm having a different error. See https://github.com/jojomatik/nuxt-3-base/actions/runs/6041755557/job/16395397674

Locally I'm actually getting a different error: ERR! Error: no builder configured! Not sure why that is though...

Could you check if you can reproduce that using the PR mentioned in the original issue description?

g1ronn1mo commented 1 year ago

Hi @chakAs3, sorry for the late reply. I was very involved in different projects over the last few months and didn't have a lot of time for my open source projects.

I've now tried to switch to version 0.0.8 but now I'm having a different error. See https://github.com/jojomatik/nuxt-3-base/actions/runs/6041755557/job/16395397674

Locally I'm actually getting a different error: ERR! Error: no builder configured! Not sure why that is though...

Could you check if you can reproduce that using the PR mentioned in the original issue description?

New Issue opend: https://github.com/storybook-vue/storybook-nuxt/issues/61#issue-1894804194

chakAs3 commented 1 year ago

please check https://storybook.nuxtjs.org/