Error when building
Unanswered
Axe posted this in #help-forum
AxeOP
Full error: https://codeshare.io/r9n18v
There are no references to any of my files so I have no clue what the issue is. Reduced my application down to just a single page.tsx file only containing an empty div but I still get the same error.
There are no references to any of my files so I have no clue what the issue is. Reduced my application down to just a single page.tsx file only containing an empty div but I still get the same error.
25 Replies
You are probably using a function that uses on
If you could share some code, that would help.
useContext outside of the component.If you could share some code, that would help.
@ncls. You are probably using a function that uses on `useContext` outside of the component.
If you could share some code, that would help.
AxeOP
//page.tsx
const Page = () => {
return <div/>
}
export default Page// layout.tsx
import './globals.css'
export const metadata = {
title: 'abc Playground',
}
const RootLayout = ({children}: {children: React.ReactNode}): JSX.Element => {
return (
<html lang="en">
<body>
{children}
</body>
</html>
)
}
export default RootLayout@Axe tsx
//page.tsx
const Page = () => {
return <div/>
}
export default Page
tsx
// layout.tsx
import './globals.css'
export const metadata = {
title: 'abc Playground',
}
const RootLayout = ({children}: {children: React.ReactNode}): JSX.Element => {
return (
<html lang="en">
<body>
{children}
</body>
</html>
)
}
export default RootLayout
Ok, weird. What version of Next.js are you running?
AxeOP
{
"name": "challenge-webui",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"fast-xml-parser": "^4.2.6",
"next": "^13.4.10",
"react": "^18.2.0"
},
"devDependencies": {
"@types/node": "^20.4.2",
"@types/react": "^18.2.15",
"autoprefixer": "^10.4.14",
"eslint": "^8.45.0",
"eslint-config-next": "^13.4.10",
"postcss": "^8.4.26",
"tailwindcss": "^3.3.3",
"typescript": "^5.1.6"
}
}AxeOP
Bump
AxeOP
Bump
@ncls. Try creating a brand new project and see if you can build it
AxeOP
Tried that as well. Doesnt work. I also tried on a server but I get the same thing
@Axe Tried that as well. Doesnt work. I also tried on a server but I get the same thing
Then try creating a project with an older Next.js version and see if you can build it there. Could be a bug in the newest version.
@ncls. Then try creating a project with an older Next.js version and see if you can build it there. Could be a bug in the newest version.
AxeOP
Tried latest version, 13.0, 12.3.4 and 11.1.4, none of which worked
The exact same error for all of them.
@Axe Click to see attachment
I can't reproduce it. I just created a fresh project using
npx create-next-app@13.4.9 and it runs through just fine.@Axe 13.9?
I just wanted to see if an older version would work. I also tried 13.4.10 just now and also worked fine.
@ncls. I just wanted to see if an older version would work. I also tried 13.4.10 just now and also worked fine.
AxeOP
Not following here.. the newest version is 13.4?
@Axe Not following here.. the newest version is 13.4?
LOL sorry, my bad. Meant 13.4.9 and 13.4.10
I sadly have absolutely no idea why this is happening. I don't know what could be causing this.
AxeOP
Yeah same. Ig Ill try submitting an issue on Github
@ncls. I sadly have absolutely no idea why this is happening. I don't know what could be causing this.
AxeOP
Just found that running "npm run build" instead of "next build" works. Shouldnt that be the same thing?
@Axe Just found that running "npm run build" instead of "next build" works. Shouldnt that be the same thing?
Running such commands from the console can lead to issues. I'd always suggest running package specific commands via a script in the
package.jsonAxeOP
Closing this as there isnt much more to gain here. For further technical details please follow this Github issue: https://github.com/vercel/next.js/issues/52956.