kimprosh
kimprosh
TTCTheo's Typesafe Cult
Created by kimprosh on 1/23/2024 in #questions
Deploy netlify failed
I made a new project with create-t3-app yesterday. But today after I deployed the project to netlify (github repo) via netlify dashboard, and when the deployment was done. I tried to access the page but I got an error:
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)
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)
Here is a part of package.json
{
"name": "create-t3-app",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"build": "next build",
"schema:format": "prisma format",
"db:push": "prisma db push",
"db:studio": "prisma studio",
"dev": "next dev",
"postinstall": "prisma generate",
"lint": "next lint",
"format": "prettier --log-level warn --write \"**/*.{jsx,js,ts,tsx}\"",
"start": "next start"
},
"dependencies": {...},
"devDependencies": {...},
"ct3aMetadata": {
"initVersion": "7.25.2"
},
"packageManager": "[email protected]"
}
{
"name": "create-t3-app",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"build": "next build",
"schema:format": "prisma format",
"db:push": "prisma db push",
"db:studio": "prisma studio",
"dev": "next dev",
"postinstall": "prisma generate",
"lint": "next lint",
"format": "prettier --log-level warn --write \"**/*.{jsx,js,ts,tsx}\"",
"start": "next start"
},
"dependencies": {...},
"devDependencies": {...},
"ct3aMetadata": {
"initVersion": "7.25.2"
},
"packageManager": "[email protected]"
}
Can you guys help me to resolve this error? Thanks!
4 replies