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

Error: Cannot find module #727

Open
6 tasks done
vivekrpatel8 opened this issue May 30, 2024 · 2 comments
Open
6 tasks done

Error: Cannot find module #727

vivekrpatel8 opened this issue May 30, 2024 · 2 comments
Labels
to triage This issue needs to be triaged

Comments

@vivekrpatel8
Copy link

vivekrpatel8 commented May 30, 2024

Describe the bug

I have a Nuxt project in which I have error.vue file and it uses @datadog/browser-rum library to record the sample sessions. When I run histoire build command it throws following error:
I am not even using error.vue file in histoire but it is automatically calling it in a build.

Error while collecting story /home/exampleFile.story.vue:
Error: Cannot find module /home/user/node_modules/@datadog/browser-rum/esm imported from file:///home/username/repo, file:///home/username/, file:///home/username/repo/_index.js, file:///home/username/node_modules
    at _resolve (file:///home/username/repo/node_modules/mlly/dist/index.mjs:2107:19)
    at resolveSync (file:///home/username/repo/node_modules/mlly/dist/index.mjs:2116:10)
    at resolvePathSync (file:///home/username/repo/node_modules/mlly/dist/index.mjs:2126:24)
    at resolvePath (file:///home/username/repo/node_modules/mlly/dist/index.mjs:2130:28)
    at isValidNodeImport (file:///home/username/repo/node_modules/mlly/dist/index.mjs:2602:30)
    at _shouldExternalize (file:///home/username/repo/node_modules/histoire/node_modules/vite-node/dist/server.mjs:78:32)
    at shouldExternalize (file:///home/username/repo/node_modules/histoire/node_modules/vite-node/dist/server.mjs:55:19)
    at ViteNodeServer.shouldExternalize (file:///home/username/repo/node_modules/histoire/node_modules/vite-node/dist/server.mjs:225:12)
    at ViteNodeServer._fetchModule (file:///home/username/repo/node_modules/histoire/node_modules/vite-node/dist/server.mjs:322:36)
    at ViteNodeServer.fetchModule (file:///home/username/repo/node_modules/histoire/node_modules/vite-node/dist/server.mjs:261:14)
    at Object.fetchModule (file:///home/username/repo/node_modules/histoire/dist/node/collect/index.js:50:37)
    at MessagePort.<anonymous> (file:///home/username/repo/node_modules/birpc/dist/index.mjs:16:41)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:761:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)

I have tried to add following in histoire.config.ts but still same issue:

export default defineConfig({
  plugins: [HstVue(), HstNuxt()],
  storyIgnored: ['**/node_modules/**', '**/dist/**', 'error.vue'],
})

Reproduction

Install @datadog/browser-rum library and call it in a error.vue file and run yarn histoire build command

System Info

I am using Nuxt3 and versions are as follows: 
"@histoire/plugin-nuxt": "^0.17.8"
"@histoire/plugin-vue": "^0.17.8"
"histoire": "^0.17.8"
"@datadog/browser-rum": "^5.9.0"

Used Package Manager

yarn

Validations

@vivekrpatel8 vivekrpatel8 added the to triage This issue needs to be triaged label May 30, 2024
@harrynikolov-riskhub
Copy link

harrynikolov-riskhub commented Jun 13, 2024

Having the same issue, but with lucide-vue-next.

For context: using PNPM in an NX monorepo. Have confirmed the folder named after "Cannot find module ..." definitely exists.

In that "esm" folder, it should find "lucide-vue-next.js", as described in "package.json" entrypoints. However, it's failing to do that.

Error while collecting story /Users/user/Code/monorepos.frontend/modules/shared/ui/src/feedback/SelectionSummary.story.vue:
Error: Cannot find module /Users/user/Code/monorepos.frontend/modules/shared/ui/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-vue-next/dist/esm imported from file:///Users/user/Code/monorepos.frontend/modules/shared/ui, file:///Users/user/Code/monorepos.frontend/modules/shared/, file:///Users/user/Code/monorepos.frontend/modules/shared/ui/_index.js, file:///Users/user/Code/monorepos.frontend/modules/shared/node_modules
    at _resolve (file:///Users/user/Code/monorepos.frontend/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2102:19)
    at resolveSync (file:///Users/user/Code/monorepos.frontend/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2111:10)
    at resolvePathSync (file:///Users/user/Code/monorepos.frontend/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2121:24)
    at resolvePath (file:///Users/user/Code/monorepos.frontend/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2125:28)
    at isValidNodeImport (file:///Users/user/Code/monorepos.frontend/node_modules/.pnpm/[email protected]/node_modules/mlly/dist/index.mjs:2585:30)
    at _shouldExternalize (file:///Users/user/Code/monorepos.frontend/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite-node/dist/server.mjs:78:32)
    at shouldExternalize (file:///Users/user/Code/monorepos.frontend/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite-node/dist/server.mjs:55:19)
    at ViteNodeServer.shouldExternalize (file:///Users/user/Code/monorepos.frontend/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite-node/dist/server.mjs:225:12)
    at ViteNodeServer._fetchModule (file:///Users/user/Code/monorepos.frontend/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite-node/dist/server.mjs:322:36)
    at ViteNodeServer.fetchModule (file:///Users/user/Code/monorepos.frontend/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite-node/dist/server.mjs:261:14)```

@vivekrpatel8
Copy link
Author

@harrynikolov-riskhub I was able to resolve mine by using following solution: #712

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

2 participants