Cannot find type definition file for 'Multer' + Render Build Only

I have an express api that I am trying to publish. I had it working until I added image upload to it with Multer. I got this working locally however once I deploy to render I get the following errors

Cannot find type definition file for ‘Multer’.

May 7 11:33:19 AM The file is in the program because:
May 7 11:33:19 AM Entry point of type library ‘Multer’ specified in compilerOptions
May 7 11:33:19 AM tsconfig.json:34:46
May 7 11:33:19 AM 34 “types”: [“jest”, “node”, “express”, “Multer”]
May 7 11:33:19 AM File is entry point of type library specified here.
May 7 11:33:19 AMsrc/modules/system/file/controllers/file-image.controller.ts:22:53 - error TS2694: Namespace ‘global.Express’ has no exported member ‘Multer’.

If I remove “Multer” from my tsconfig types then it breaks locally with a similar error. Here are the steps I have taken to remove this error from my local machine:

Package.json

"devDependencies: {
    ...,
    "@types/express": "^4.17.21",
    "@types/multer": "^1.4.11",
    ...
}

TSConfig

{
    "types": ["jest", "node", "express", "Multer"]
}

I also have a types.d.ts file at the root of my project with the following

import { Details } from 'express-useragent'

declare global {
    namespace Express {
        interface Request {
            useragent?: Details
            ipAddress?: string
        }
    }
}

Any help would be appreciated

Hi Jason,

Is there a reason you have this only in your devDependenies, and not in your dependancies?

Regards,

Matt

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.