Cannot find module happy-wrapper
See original GitHub issueI got this error when I upgraded vite-plugin-md to 0.17.x in my vitesse project.
failed to load config from /Users/xxx/Work/Vue/vitesse/vite.config.ts
error when starting dev server:
Error: Cannot find module '/Users/xxx/Work/Vue/vitesse/node_modules/.pnpm/vite-plugin-md@0.17.4_wie7zz22o3tz6qyv6muewmoury/node_modules/@yankeeinlondon/happy-wrapper/dist/index.cjs'
at createEsmNotFoundErr (internal/modules/cjs/loader.js:929:15)
at finalizeEsmResolution (internal/modules/cjs/loader.js:922:15)
at resolveExports (internal/modules/cjs/loader.js:450:14)
at Function.Module._findPath (internal/modules/cjs/loader.js:490:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/Users/xxx/Work/Vue/vitesse/node_modules/.pnpm/vite-plugin-md@0.17.4_wie7zz22o3tz6qyv6muewmoury/node_modules/vite-plugin-md/dist/index.js:11869:28)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
Steps:
- clone vitesse
- upgrade vite-plugin-md to 0.16.x or 0.17.x
- run pnpm dev
Issue Analytics
- State:
- Created a year ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
How do I resolve "Cannot find module" error using Node.js?
Using npm install installs the module into the current directory only (in a subdirectory called node_modules ). Is app.js located under ...
Read more >Can't find module 'hapi' · Issue #1 · dwyl/learn-hapi - GitHub
When I try to run my first completed challenge "makemehapi run program.js" I get this error. But I installed hapi with 'npm install...
Read more >Cannot find module wrappy npm installation - How to fix it
Cannot find module wrappy npm installationis an error caused by by diffierent version of NPM installed. To fix it follow the given steps....
Read more >vite exports is not defined | The AI Search Engine You Control
tryNodeResolve fails on Firebase. It swallows this exception from _resolveExports inside resolveExports : Missing "." export in "firebase" package. It seems ...
Read more >Fix Global Installs Not Working | "Cannot find module" error FIX
Getting " Cannot find module " after installing something globally (with -g)? Well, this video shows you how to fix global package/module ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi folks, sorry been trying to ensure that everything is ESM and CJS compliant and I think there were a few bumps.
For context, I’m trying to make sure that the dependency stack works for ESM fully (it has not in the past) and there are a few packages which Vite seems to take issue with:
fp-ts
- it has an ESM implementation but the way it’s done is awkward and Vite doesn’t work well with it so I’ve made the use of this dependency explicit and rolled and shaken into the actualvite-plugin-md
; adds a tiny bit to the bundle size but it just works this way so worth the additional payloadmarkdown-it
- it has no ESM implementation (if I remember correctly) so I’ve pushed it into being a top-level dependency of consumers by making it a peer dependency. Being a top-level dependency allows the bundler to consume the CJS and convert to ESM if the consumer is using ESM (and leave it as-is if consumer is CJS).With
happy-wrapper
there is yet another issue with ESM … and that isn’t directly to do withhappy-wrapper
but thehappy-dom
implementation which Vite can handle when a top level dependency but not otherwise. I’m not sure I have fully understood this yet but I had thought by makinghappy-wrapper
an ESM export only that I might be able to avoid this. Based on the issues folks are having though I can see there’s a little more tuning to be done.Sorry for the inconvenience. ESM will be a great world once we’re finally there but the journey has a lot of little potholes along it. Anyway, just woke up but i’ll get a patch in for this today and it sounds like others have found a work-around for now.
@Codermar Now
markdown-it
is apeerDependencies
, so you need install it in your project.