Skip to content

array-flatten #6501

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

Open
ranouf opened this issue May 2, 2025 · 1 comment
Open

array-flatten #6501

ranouf opened this issue May 2, 2025 · 1 comment

Comments

@ranouf
Copy link

ranouf commented May 2, 2025

Hi,

I deployed my next.js webapp in azure web app and I have an issue in the log when I open the url:

Cannot find module 'array-flatten'Require stack:- C:\home\site\wwwroot\node_modules\express\lib\router\route.js- C:\home\site\wwwroot\node_modules\express\lib\router\index.js- C:\home\site\wwwroot\node_modules\express\lib\application.js- C:\home\site\wwwroot\node_modules\express\lib\express.js- C:\home\site\wwwroot\node_modules\express\index.js- C:\home\site\wwwroot\server.js- C:\Program Files (x86)\iisnode\interceptor.jsat Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)at Module._load (node:internal/modules/cjs/loader:1051:27)at Module.require (node:internal/modules/cjs/loader:1311:19)at Module.patchedRequire (C:\PROGRA2\SITEEX1\NODEAP1\2111.4\nodejs\node_modules\diagnostic-channel\dist\src\patchRequire.js:16:46)at Hook._require.Module.require (C:\PROGRA2\SITEEX1\NODEAP1\2111.4\nodejs\node_modules\require-in-the-middle\index.js:167:34)at require (node:internal/modules/helpers:179:18)at Object. (C:\home\site\wwwroot\node_modules\express\lib\router\route.js:17:15)at Module._compile (node:internal/modules/cjs/loader:1469:14)at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)at Module.load (node:internal/modules/cjs/loader:1288:32)Application has thrown an uncaught exception and is terminated:Error: Cannot find module 'array-flatten'Require stack:- C:\home\site\wwwroot\node_modules\express\lib\router\route.js- C:\home\site\wwwroot\node_modules\express\lib\router\index.js- C:\home\site\wwwroot\node_modules\express\lib\application.js- C:\home\site\wwwroot\node_modules\express\lib\express.js- C:\home\site\wwwroot\node_modules\express\index.js- C:\home\site\wwwroot\server.js- C:\Program Files (x86)\iisnode\interceptor.jsat Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)at Module._load (node:internal/modules/cjs/loader:1051:27)at Module.require (node:internal/modules/cjs/loader:1311:19)at Module.patchedRequire (C:\PROGRA2\SITEEX1\NODEAP1\2111.4\nodejs\node_modules\diagnostic-channel\dist\src\patchRequire.js:16:46)at Hook._require.Module.require (C:\PROGRA2\SITEEX1\NODEAP1\2111.4\nodejs\node_modules\require-in-the-middle\index.js:167:34)at require (node:internal/modules/helpers:179:18)at Object. (C:\home\site\wwwroot\node_modules\express\lib\router\route.js:17:15)at Module._compile (node:internal/modules/cjs/loader:1469:14)at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)at Module.load (node:internal/modules/cjs/loader:1288:32)

When I look in package.json, I added the package array-flatten just in case, but still continue to get the issue:

"dependencies": {
    "@emotion/react": "11.14.0",
    "@emotion/styled": "11.14.0",
    "@mui/x-data-grid": "8.2.0",
    "@next/eslint-plugin-next": "14.0.4",
    "array-flatten": "^3.0.0",
    "bcrypt": "5.1.1",
    "bootstrap": "5.3.5",
    "express": "5.1.0",
    "firebase": "11.6.1",
    "leaflet": "1.9.4",
    "leaflet-defaulticon-compatibility": "0.1.2",
    "mongoose": "8.14.1",
    "next": "15.3.1",
    "next-auth": "4.24.11",
    "react": "18.3.1",
    "react-autosuggest": "10.1.0",
    "react-bootstrap": "2.10.9",
    "react-dom": "18.3.1",
    "react-firebase-hooks": "5.1.1",
    "react-icons": "4.12.0",
    "react-leaflet": "4.2.1",
    "react-toastify": "10.0.4",
    "react-tooltip": "4.5.1",
    "recharts": "2.15.3",
    "webpack": "5.99.7",
    "webpack-cli": "6.0.1"
  },
  "devDependencies": {
    "@types/node": "22.15.3",
    "eslint": "9.25.1",
    "eslint-config-next": "15.3.1"
  }

Any idea how to fix it?

@ranouf ranouf added the question label May 2, 2025
@krzysdz
Copy link
Contributor

krzysdz commented May 2, 2025

router since version 2.1.0 does not use array-flatten (see pillarjs/router#126). Express 5.1.0, which you have listed in package.json depends on router@^2.2.0.

Did you try removing node_modules and package-lock.json and running npm install again? The require stack points to express/lib/router/route.js, which was there in Express 4, but does not exist in Express 5 - it has been separated into router package).

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

No branches or pull requests

3 participants