New Metronic Docs!Added Integration Docs with Starter Kits Apps for Laravel, Laravel Livewire, Angular, Vue, Symfony, Blazor Server, Django & Flask & more
Browse Docs

Build error running npm run build


When running npm run build, it always exists with the following error:

> Build error occurred
[Error: Failed to collect page data for /api/user-management/settings/general] {
type: 'Error'
}


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)


Ugh - that was it! Thank you.



Great! All the best with your projects happy


Your Support Matters!

We will highly appreciate your Metronic Review on Themeforest.
Please go to Themeforest Downloads page, select Metronic & leave your feedback.

Thanks for your reply Sean.

I have redownloaded Metronic v9.2.1. The install is based on a fresh copy of the Nextjs Typescript project.

I copy the files into Ubuntu on WSL, run npm install --force, create the .env file with relevant secrets, then run npx prisma generate which successfully generates. Following that, I run npx prisma migrate dev which succeeds. npm run dev successfully serves the application showing the login screen with default credentials, and then redirecting to the dashboard after login.

Finally, I run npm run build which fails with the below output:


> metronic-nextjs@9.2.1 build
> next build

â–² Next.js 15.3.2
- Environments: .env

Creating an optimized production build ...
[src/media_query.rs:1032:11]
✓ Compiled successfully in 51s
✓ Linting and checking validity of types
Collecting page data .ReferenceError: File is not defined
at 66962 (.next/server/app/api/user-management/settings/general/route.js:1:3801)
at t (.next/server/webpack-runtime.js:1:128)
at r (.next/server/app/api/user-management/settings/general/route.js:1:10104)
at <unknown> (.next/server/app/api/user-management/settings/general/route.js:1:10146)
at t.X (.next/server/webpack-runtime.js:1:1206)
at <unknown> (.next/server/app/api/user-management/settings/general/route.js:1:10117)
at Object.<anonymous> (.next/server/app/api/user-management/settings/general/route.js:1:10174)

> Build error occurred
[Error: Failed to collect page data for /api/user-management/settings/general] {
type: 'Error'
}



Hi,

We have tested the build of v9.2.1 and it worked well. Can you please make sure that you use the latest NPM version ? We have tested it with Nodejs v10.9.2 and above.

Regards,
Sean



Hi,

Sorry for the late reply. It seems we missed your question in our system.

May I know which version are you using ? Metronic 9.2.x Next.js or Vite ? Can you try the latest Metronic v9.2.1 by downloading it from your themeforest.net account ?

Regards,
Sean


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(