question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multer is missing for config.d.ts

See original GitHub issue

config.d.ts references multer but it’s not included/referenced in tsoa runtime, causing an error message.

p_1      | $ rm -rf /build && tsoa spec-and-routes && tsc
p_1      | node_modules/@tsoa/runtime/dist/config.d.ts(2,39): error TS2307: Cannot find module 'multer' or its corresponding type declarations.

Nevertheless, I can still access my OpenAPI spec and SwaggerUI. I am not using any form/multi endpoints from the spec, that might be why it still works. Also I cannot say how a real API would be affected, currently this is just a few mock controllers to produce a spec.

Sorting

  • I’m submitting a …

    • bug report
    • feature request
    • support request
  • I confirm that I

    • used the search to make sure that a similar issue hasn’t already been submit

Expected Behavior

No error when running tsoa in docker container / building docker image. Peer dependency is shipped / declared correctly (?)

Current Behavior

When running tsoa spec-and-routes I see this message:

p_1      | $ rm -rf /build && tsoa spec-and-routes && tsc
p_1      | node_modules/@tsoa/runtime/dist/config.d.ts(2,39): error TS2307: Cannot find module 'multer' or its corresponding type declarations.

Nevertheless, I can still access my OpenAPI spec and SwaggerUI. I am not using any form/multi endpoints from the spec, that might be why it still works. Also I cannot say how a real API would be affected, currently this is just a few mock controllers to produce a spec.

Note: I only see the message when calling tsoa during a Docker image build, but when going into node_modules/@tsoa/.../config.d.ts VS code is also claiming that multer is missing.

Adding multer as dev dependency gets rid of the warning in the logs and in VS code, but it feels strange that I have to add the dependency explicitly to my project.

Possible Solution

Steps to Reproduce

If needed, I can provide more details and a small repro later on.

Context (Environment)

Version of the library: 3.14.1 and 4.0.0-rc1 Version of NodeJS: 16 (LTS, Alpine Image as base for Docker image)

  • Confirm you were using yarn not npm: [x]

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:9
  • Comments:9

github_iconTop GitHub Comments

7reactions
akerpelmcommented, May 2, 2022

this appears to also be present in 4.0.0 - with the temporary fix being the addition of multer as a dependency (though as mentioned, somewhat unexpected behavior).

5reactions
frederikhmcommented, Jun 10, 2022

I also encountered this bug with tsoa 4.1.0. I was not using docker, but still unable to tun yarn run tsc --outDir build --experimentalDecorators due to the error. manually installing multer and @types/multer as dev dependencies fixed the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multer module won't start - node.js - Stack Overflow
I got a similar error Error: Cannot find module 'multer' and I solved it by running the command npm install multer.
Read more >
@types/multer - npm
This package contains type definitions for multer (https://github.com/expressjs/multer). Details. Files were exported from https://github.com/ ...
Read more >
Upload files to the Node.js server with Express and Multer
We will use MongoDB to store user data. We have already seen how to use it with Node.js in this tutorial. Configure Mongoose....
Read more >
Could not find declaration file for module 'X' Error | bobbyhadz
The error "Could not find declaration file for module" occurs when TypeScript cannot find the type declaration for a module. To solve the...
Read more >
How to fix error TS7016: Could not find a declaration file for ...
Create a folder called typings · Create a file in that folder called index.d.ts · Declare the module(s) like this:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found