Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't resolve dependencies correctly #738

Open
6 tasks done
kainstar opened this issue Jun 26, 2024 · 7 comments
Open
6 tasks done

Can't resolve dependencies correctly #738

kainstar opened this issue Jun 26, 2024 · 7 comments
Labels
to triage This issue needs to be triaged

Comments

@kainstar
Copy link

Describe the bug

When i import lucide-vue-next, histoire report it cannot find module:

Error while collecting story /Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/demo.story.vue:
Error: Cannot find module /Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-vue-next/dist/esm imported from file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old, file:///Users/zsk/code/github.com/kainstar/reproduce/, file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/_index.js, file:///Users/zsk/code/github.com/kainstar/reproduce/node_modules
    at _resolve (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2102:19)
    at resolveSync (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2111:10)
    at resolvePathSync (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2121:24)
    at resolvePath (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2125:28)
    at isValidNodeImport (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2585:30)
    at _shouldExternalize (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/server.mjs:78:32)
    at shouldExternalize (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/server.mjs:55:19)
    at ViteNodeServer.shouldExternalize (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/server.mjs:225:12)
    at ViteNodeServer._fetchModule (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/server.mjs:322:36)
    at ViteNodeServer.fetchModule (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/server.mjs:261:14)

Reason and solution

After debug, i found it's because histoire using vite-node with a old version 0.34.7 whose latest version is 1.6.0, when i force using [email protected] with pnpm's overrides config, it works.

So is histoire has any play to upgrade vite-node to latest version?

Reproduction

https://stackblitz.com/edit/histoire-vue3-starter-hzthpp?file=src%2Fdemo.story.vue

System Info

System:
    OS: macOS 14.4.1
    CPU: (8) arm64 Apple M2
    Memory: 772.61 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/Library/Caches/fnm_multishells/18515_1719402069456/bin/node
    Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/18515_1719402069456/bin/yarn
    npm: 10.2.3 - ~/Library/Caches/fnm_multishells/18515_1719402069456/bin/npm
    pnpm: 8.15.1 - ~/Library/Caches/fnm_multishells/18515_1719402069456/bin/pnpm
  Browsers:
    Chrome: 126.0.6478.126
    Safari: 17.4.1
  npmPackages:
    @histoire/plugin-vue: ^0.17.17 => 0.17.17 
    @vitejs/plugin-vue: ^5.0.5 => 5.0.5 
    histoire: ^0.17.17 => 0.17.17 
    vite: ^5.3.1 => 5.3.1

Used Package Manager

pnpm

Validations

@kainstar kainstar added the to triage This issue needs to be triaged label Jun 26, 2024
Copy link

stackblitz bot commented Jun 26, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@renatomoor
Copy link

I'm having the same issue when using the carousel component from shadcn-vue.

Error: Cannot find module /Users/renatomoor/seelo/co-living-davos/node_modules/.pnpm/[email protected][email protected]/node_modules/embla-carousel-vue/esm imported from file:///Users/renatomoor/seelo/co-living-davos, file:///Users/renatomoor/seelo/, file:///Users/renatomoor/seelo/co-living-davos/_index.js, file:///Users/renatomoor/seelo/node_modules
    at _resolve (file:///Users/renatomoor/seelo/co-living-davos/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2102:19)
    at resolveSync (file:///Users/renatomoor/seelo/co-living-davos/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2111:10)
    at resolvePathSync (file:///Users/renatomoor/seelo/co-living-davos/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2121:24)
    at resolvePath (file:///Users/renatomoor/seelo/co-living-davos/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2125:28)
    at isValidNodeImport (file:///Users/renatomoor/seelo/co-living-davos/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2585:30)
    at _shouldExternalize (file:///Users/renatomoor/seelo/co-living-davos/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/server.mjs:78:32)
    at shouldExternalize (file:///Users/renatomoor/seelo/co-living-davos/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/server.mjs:55:19)
    at ViteNodeServer.shouldExternalize (file:///Users/renatomoor/seelo/co-living-davos/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/server.mjs:225:12)
    at ViteNodeServer._fetchModule (file:///Users/renatomoor/seelo/co-living-davos/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/server.mjs:322:36)
    at ViteNodeServer.fetchModule (file:///Users/renatomoor/seelo/co-living-davos/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/server.mjs:261:14)

@renatomoor
Copy link

I've overrided to [email protected] but now I have this error in the console:

/Users/renatomoor/seelo/co-living-davos/node_modules/.histoire/plugins/builtin_tailwind-tokens/Tailwind.story.js:1
import 'histoire-style'
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1178:20)
    at Module._compile (node:internal/modules/cjs/loader:1220:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

@renatomoor
Copy link

I remove the tailwind tokens default plugin for histoire like this for now:

import { tailwindTokens } from 'histoire/src/node/builtin-plugins/tailwind-tokens'

export default defineConfig({
  plugins: [
    tailwindTokens({
      configFile: null,
    }),
  ],
})

@ColinEspinas
Copy link

We encountered the same issue:

Error while collecting story /home/cespinas/dev/netatmo/onesite/packages/ui/histoire/Banners.story.vue:
Error: Cannot find module /home/cespinas/dev/netatmo/onesite/node_modules/.pnpm/[email protected][email protected][email protected]_/node_modules/lucide-vue-next/dist/esm imported from file:///home/cespinas/dev/netatmo/onesite/packages/ui, file:///home/cespinas/dev/netatmo/onesite/packages/, file:///home/cespinas/dev/netatmo/onesite/packages/ui/_index.js, file:///home/cespinas/dev/netatmo/onesite/packages/node_modules
    at _resolve (file:///home/cespinas/dev/netatmo/onesite/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2102:19)
    at resolveSync (file:///home/cespinas/dev/netatmo/onesite/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2111:10)
    at resolvePathSync (file:///home/cespinas/dev/netatmo/onesite/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2121:24)
    at resolvePath (file:///home/cespinas/dev/netatmo/onesite/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2125:28)
    at isValidNodeImport (file:///home/cespinas/dev/netatmo/onesite/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2585:30)
    at _shouldExternalize (file:///home/cespinas/dev/netatmo/onesite/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite-node/dist/server.mjs:78:32)
    at shouldExternalize (file:///home/cespinas/dev/netatmo/onesite/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite-node/dist/server.mjs:55:19)
    at ViteNodeServer.shouldExternalize (file:///home/cespinas/dev/netatmo/onesite/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite-node/dist/server.mjs:225:12)
    at ViteNodeServer._fetchModule (file:///home/cespinas/dev/netatmo/onesite/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite-node/dist/server.mjs:322:36)
    at ViteNodeServer.fetchModule (file:///home/cespinas/dev/netatmo/onesite/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite-node/dist/server.mjs:261:14)

Have a great day, Colin.

@maroluke
Copy link

maroluke commented Oct 29, 2024

When will that fix be released?
Is there a workaround?

@UchVuch
Copy link

UchVuch commented Dec 5, 2024

We faced the same problem when installing and importing embla-carousel-vue for our historie:
image
image
image
image
image

When started npm run story:dev:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

5 participants