8000 Can't collect stories with konvajs in Nuxt project · Issue #786 · histoire-dev/histoire · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Can't collect stories with konvajs in Nuxt project #786
Open
@qmpwwsd

Description

@qmpwwsd

Describe the bug

I want to use the Histoire in a project with Nuxt and konvajs. But after setup configuration, I got this error:

ℹ Vite client warmed up in 1ms                                                                                                                                                                                                                                                           10:19:29 AM
Error while collecting story /home/ds/histoire-example/stories/Button.story.vue:
Error: Cannot find module 'canvas'
Require stack:
- /home/ds/histoire-example/node_modules/.pnpm/konva@9.3.18/node_modules/konva/lib/index-node.js
    at Function._resolveFilename (node:internal/modules/cjs/loader:1405:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1061:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1066:22)
    at Function._load (node:internal/modules/cjs/loader:1215:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1491:12)
    at require (node:internal/modules/helpers:135:16)
    at /home/ds/histoire-example/node_modules/.pnpm/konva@9.3.18/node_modules/konva/lib/index-node.js:4:16
    at ViteNodeRunner.runModule (file:///home/ds/histoire-example/node_modules/.pnpm/vite-node@0.34.7_@types+node@22.13.10_sass@1.85.1_terser@5.39.0/node_modules/vite-node/dist/client.mjs:342:11)
Collect stories end 4356ms

The project works well, but Histoire doesn't want to work correctly. Also, I don't use konvajs in stories, it's existed in project only, for now.
The 'canvas' module is not installed directly in the project. But if I tried to add it, then I got this:

Error while collecting story /home/denys/Projects/ronaldo-web/stories/Button.story.vue:
Error: Cannot find module '../build/Release/canvas.node'
Require stack:
- /home/ds/histoire-example/node_modules/.pnpm/canvas@3.1.0/node_modules/canvas/lib/bindings.js
- /home/ds/histoire-example/node_modules/.pnpm/canvas@3.1.0/node_modules/canvas/lib/canvas.js
- /home/ds/histoire-example/node_modules/.pnpm/canvas@3.1.0/node_modules/canvas/index.js
- /home/ds/histoire-example/node_modules/.pnpm/konva@9.3.18/node_modules/konva/lib/index-node.js
    at Function._resolveFilename (node:internal/modules/cjs/loader:1405:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1061:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1066:22)
    at Function._load (node:internal/modules/cjs/loader:1215:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1491:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.<anonymous> (/home/ds/histoire-example/node_modules/.pnpm/canvas@3.1.0/node_modules/canvas/lib/bindings.js:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1734:14)

Reproduction

  • Create Nuxt project
  • Install konvajs
  • Add the default configuration from Histoire docs and the default story

System Info

Linux Ubuntu

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    to triageThis issue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0