nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
65.53k stars 7.46k forks source link

Netlify deploy fails Namespace 'global.Express' has no exported member 'Multer'. #11896

Closed nolafs closed 1 year ago

nolafs commented 1 year ago

Is there an existing issue for this?

Current behavior

Local build works perfectly fine. Following was added to my media module.

import {MulterModule} from "@nestjs/platform-express";
import {Multer} from 'Multer';
   MulterModule.register({
      dest: './uploads', // Set the destination folder for uploaded files
    })

and added the type Multer to the tsconfig. This has fixed the build for locally but when deployed to Netlfy, I get the following error:

Namespace 'global.Express' has no exported member 'Multer'.

Build is failing.

Minimum reproduction code

https://github.com/nolafs/spacebrainz/tree/main/apps/api/src/app/media

Steps to reproduce

You need build on netlify

Expected behavior

It should build without issues as my local build is doing

Package

Other package

No response

NestJS version

No response

Packages versions

{

  "private": true,
  "override": {
    "react": "^18.2.0",
    "@types/react": "^18.0.25",
    "react-dom": "^18.2.0"
  },
  "browser": {
    "fs": false,
    "path": false,
    "os": false
  },
  "dependencies": {
    "@apollo/client": "^3.7.14",
    "@auth0/nextjs-auth0": "^2.3.1",
    "@emotion/react": "^11.9.3",
    "@emotion/styled": "^11.9.3",
    "@fortawesome/fontawesome-svg-core": "^6.2.1",
    "@fortawesome/free-brands-svg-icons": "^6.2.1",
    "@fortawesome/free-solid-svg-icons": "^6.2.1",
    "@fortawesome/react-fontawesome": "^0.2.0",
    "@headlessui/react": "^1.7.13",
    "@heroicons/react": "^2.0.16",
    "@material-tailwind/react": "^1.2.4",
    "@mdx-js/loader": "^2.2.1",
    "@mdx-js/react": "^2.2.1",
    "@mui/material": "^5.8.7",
    "@mui/system": "^5.13.2",
    "@nestjs/axios": "^2.0.0",
    "@nestjs/common": "9.4.2",
    "@nestjs/config": "^2.3.1",
    "@nestjs/core": "9.4.2",
    "@nestjs/passport": "^9.0.3",
    "@nestjs/platform-express": "^9.4.2",
    "@nestjs/swagger": "6.3.0",
    "@next/bundle-analyzer": "^13.2.4",
    "@next/font": "^13.1.6",
    "@next/mdx": "^13.1.6",
    "@nrwl/next": "16.2.2",
    "@reduxjs/toolkit": "^1.8.2",
    "@semantic-release/github": "^7.2.3",
    "@sentry/nextjs": "^7.52.1",
    "@sentry/node": "^7.52.1",
    "@sentry/profiling-node": "^0.3.0",
    "@staticcms/core": "^1.2.8",
    "@stripe/stripe-js": "^1.53.0",
    "@svgr/webpack": "^6.5.1",
    "@tailwindcss/aspect-ratio": "^0.4.2",
    "@tailwindcss/typography": "^0.5.9",
    "@tippyjs/react": "^4.2.6",
    "add": "^2.0.6",
    "apollo-link": "^1.2.14",
    "apollo-link-http": "^1.5.17",
    "auth0": "^3.4.0",
    "axios": "^1.3.4",
    "body-parser": "^1.20.2",
    "buffer-to-stream": "^1.0.0",
    "chart.js": "^3.8.0",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.14.0",
    "cloudinary": "^1.37.2",
    "contentful": "^9.3.3",
    "daisyui": "^2.49.0",
    "doka": "^0.1.0",
    "dotenv": "^16.0.3",
    "express": "^4.18.2",
    "filepond": "^4.30.4",
    "filepond-plugin-image-crop": "^2.0.6",
    "filepond-plugin-image-edit": "^1.6.3",
    "filepond-plugin-image-exif-orientation": "^1.0.11",
    "filepond-plugin-image-preview": "^4.6.11",
    "filepond-plugin-image-resize": "^2.0.10",
    "fs": "^0.0.1-security",
    "graphql": "^15.0.0",
    "graphql-request": "^6.0.0",
    "graphql-tag": "^2.12.6",
    "gray-matter": "^4.0.3",
    "gsap": "npm:@gsap/business@^3.11.4",
    "jwks-rsa": "^3.0.1",
    "logrocket": "^4.0.1",
    "metamask-react": "^2.4.0",
    "moment": "^2.29.4",
    "multer": "^1.4.5-lts.1",
    "next": "13.1.1",
    "next-seo": "^5.15.0",
    "next-themes": "^0.2.0",
    "passport": "^0.6.0",
    "passport-auth0": "^1.4.3",
    "passport-jwt": "^4.0.1",
    "passport-local": "^1.0.0",
    "react": "18.2.0",
    "react-accessible-accordion": "^5.0.0",
    "react-avatar-editor": "^13.0.0",
    "react-background-video-player": "^1.1.8",
    "react-chartjs-2": "^4.3.1",
    "react-cookie-consent": "^8.0.1",
    "react-copy-to-clipboard": "^5.1.0",
    "react-countdown": "^2.3.2",
    "react-dom": "18.2.0",
    "react-filepond": "^7.1.2",
    "react-icomoon": "^2.5.4",
    "react-icons": "^4.4.0",
    "react-markdown": "^8.0.5",
    "react-modal-video": "^2.0.0",
    "react-player": "^2.11.0",
    "react-redux": "^8.0.2",
    "react-tabs": "^5.1.0",
    "react-use": "^17.4.0",
    "reflect-metadata": "^0.1.13",
    "remark": "^14.0.2",
    "remark-html": "^15.0.1",
    "rxjs": "^7.0.0",
    "serverless-http": "^3.2.0",
    "stripe": "^12.5.0",
    "swiper": "^8.2.4",
    "tslib": "^2.3.0",
    "uuid": "^9.0.0",
    "winston": "^3.8.2",
    "winston-transport-sentry-node": "^2.7.0"
  },
  "devDependencies": {
    "@babel/preset-react": "^7.14.5",
    "@nestjs/schematics": "9.2.0",
    "@nestjs/testing": "9.4.2",
    "@netlify/functions": "^1.4.0",
    "@nrwl/cypress": "16.2.2",
    "@nrwl/esbuild": "16.2.2",
    "@nrwl/eslint-plugin-nx": "16.2.2",
    "@nrwl/jest": "16.2.2",
    "@nrwl/js": "16.2.2",
    "@nrwl/linter": "16.2.2",
    "@nrwl/nest": "16.2.2",
    "@nrwl/node": "16.2.2",
    "@nrwl/nx-cloud": "16.0.5",
    "@nrwl/react": "16.2.2",
    "@nrwl/webpack": "16.2.2",
    "@nrwl/workspace": "16.3.0",
    "@semantic-release/changelog": "^5.0.1",
    "@semantic-release/commit-analyzer": "^8.0.0",
    "@semantic-release/exec": "^5.0.0",
    "@semantic-release/git": "^9.0.1",
    "@semantic-release/npm": "^7.1.3",
    "@semantic-release/release-notes-generator": "^9.0.0",
    "@tailwindcss/forms": "^0.5.3",
    "@testing-library/react": "13.4.0",
    "@types/gsap": "^3.0.0",
    "@types/jest": "29.4.0",
    "@types/multer": "^1.4.7",
    "@types/node": "18.11.9",
    "@types/passport-local": "^1.0.35",
    "@types/react": "18.0.25",
    "@types/react-dom": "18.0.9",
    "@typescript-eslint/eslint-plugin": "5.59.7",
    "@typescript-eslint/parser": "5.59.7",
    "apollo-server-lambda": "^3.12.0",
    "autoprefixer": "10.4.13",
    "babel-jest": "29.4.3",
    "cypress": "^12.2.0",
    "esbuild": "0.17.17",
    "eslint": "~8.15.0",
    "eslint-config-next": "13.1.1",
    "eslint-config-prettier": "8.1.0",
    "eslint-plugin-cypress": "^2.10.3",
    "eslint-plugin-import": "2.26.0",
    "eslint-plugin-jsx-a11y": "6.6.1",
    "eslint-plugin-react": "7.31.11",
    "eslint-plugin-react-hooks": "4.6.0",
    "faunadb": "^4.8.0",
    "ffmpeg": "^0.0.4",
    "fluent-ffmpeg": "^2.1.2",
    "jest": "29.4.3",
    "jest-environment-jsdom": "29.4.3",
    "jest-environment-node": "^29.4.1",
    "nx": "16.2.2",
    "postcss": "8.4.19",
    "prettier": "^2.6.2",
    "react-test-renderer": "18.2.0",
    "sass": "1.62.1",
    "semantic-release": "^17.4.7",
    "sharp": "^0.31.3",
    "tailwindcss": "^3.2.4",
    "ts-jest": "29.1.0",
    "ts-node": "10.9.1",
    "typescript": "5.0.4"
  }
}

Node.js version

16.13.0

In which operating systems have you tested?

Other

No response

Tony133 commented 1 year ago

@nolafs I wanted to report that your minimum reproduction link is not working from 404.

screen-repo
kamilmysliwiec commented 1 year ago

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.