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

Bug: Cannot Find Module 'multer' #48

Closed
morrisrob opened this issue Nov 30, 2022 · 6 comments
Closed

Bug: Cannot Find Module 'multer' #48

morrisrob opened this issue Nov 30, 2022 · 6 comments

Comments

@morrisrob
Copy link

Bug Report

Current Behavior
"Error: Cannot find module 'multer'" after updating to 3.0.2. Prior to updating koa/multer, I was using v3.0.0 without any issues. We use webpack for bundling. It looks like the issue has to do with webpack and the use of fix-esm which was introduced in v3.0.2. Any thoughts / ideas on how to get this working? Thanks!

Environment

  • Node/npm/yarn version: Node 12 yarn v3.1.1
  • @koa/multer & koa version: @koa/multer 3.0.2

Additional context/Screenshots
image

@morrisrob morrisrob changed the title Bug: Bug: Cannot Find Module 'multer' Dec 8, 2022
@saveman71
Copy link

I have the same problem, but with yarn and pnp:

/home/user/project/.pnp.cjs:21562
      Error.captureStackTrace(firstError);
            ^
Error: fix-esm tried to access multer, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: multer
Required by: fix-esm@npm:1.0.1 (via /home/user/project/.yarn/cache/fix-esm-npm-1.0.1-f37e52f4ce-002b105fa2.zip/node_modules/fix-esm/)

Require stack:
- /home/user/project/.yarn/cache/fix-esm-npm-1.0.1-f37e52f4ce-002b105fa2.zip/node_modules/fix-esm/index.js
- /home/user/project/.yarn/__virtual__/@koa-multer-virtual-54250cd2fc/0/cache/@koa-multer-npm-3.0.2-f015419f43-6e66e4cf6d.zip/node_modules/@koa/multer/index.js

@brogeby
Copy link

brogeby commented Mar 24, 2023

@saveman71
@morrisrob
Do you have multer installed seperately?

@3imed-jaberi
Copy link
Member

I have checked the module with both module formats (ESM and CJS), and there's no problem with the module.
As @brogeby mentioned, make sure to install 'multer' separately.

You can check the example in 'README.md' and don't forget to install the modules.

@3imed-jaberi
Copy link
Member

I will close the issue for now, feel free to re-open it in case you didn't solve the problem.

@remcohaszing
Copy link

What was the reason to use fix-esm in the first place? multer can just be required. Maybe this was an issue at the time, but not anymore? fix-esm makes the dependency tree not statically analyzable, meaning it’s incompatible with bundlers.

@shellscape
Copy link

@titanism why are you closing issues without a resolution? There are now two issues closed that are resolved by an open and unreviewed PR. this one, #51 and #52 should all be open. This is incredibly frustrating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants