Next.js Discord

Discord Forum

Deployment Error

Unanswered
Muhammed Khal posted this in #help-forum
Open in Discord
Hai Guys, my nextjs application is getting some error when I deploy on the Netlify

This function has crashed
An unhandled error in the function code triggered the following message:

ReferenceError - module is not defined in ES module scope This file is being treated as an ES module because it has a '.js' file extension and '/var/task/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.

Stack trace
ReferenceError: module is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/var/task/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
    at file:///var/task/___netlify-handler.js:1:1
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
Connection details
Netlify internal ID: 01HCH3BDYV4022H91AF7GF9CXN


Does anyone got issue before , if yes can anyone help me please

I already added type as module in my package.js

0 Replies