Weird behavior
Unanswered
Ojos Azules posted this in #help-forum
Ojos AzulesOP
this the result of pnpm dev, I don't know why it redirects to the /undefined with the error code 404!
I haven't added any code of mine yet, and the problem is when I build the project, and then I request the root page in the webbrowser, it doesn't show anything!
I haven't added any code of mine yet, and the problem is when I build the project, and then I request the root page in the webbrowser, it doesn't show anything!
22 Replies
American black bear
send a screenshot of your folder structure
Western paper wasp
Check if there is
app/page.tsx or pages/index.tsx, and send a screenshot of the folder structure. A redirect to /undefined usually means that env/route is expected somewhere, but it is not there.Ojos AzulesOP
Western paper wasp
By env/route I meant an environment variable or route param that is used to build a redirect URL
A redirect to /undefined usually means that some env variable is not picked up/not defined at runtime, and the redirect URL is constructed from it, resulting in “undefined”
Check
next.config.* for redirects(), rewrites(), basePath, assetPrefix, often process.env.__SOMETHING__app/page.tsx, layout.tsx, and any client components redirect(), router.push(), router.replace(), <Link href={...}>You can also check
middleware.ts or middleware.js for NextResponse.redirect(...)Ojos AzulesOP
mgonna check them now
Ojos AzulesOP
could you guide how I can fill it? which source or what is the right question to ask deepseek so it can help me filling it
Western paper wasp
Your
Almost 100% means that somewhere in the code or
next.config.ts is empty.Almost 100% means that somewhere in the code or
config, process.env.__SOMETHING__ is being used, but this variable is not defined, and the URL is being assembled from itNile perch
Show your app/layout.tsx and app/page.tsx files.
@Western paper wasp Your `next.config.ts` is empty.
Almost 100% means that somewhere in the code or `config, process.env.__SOMETHING__` is being used, but this variable is not defined, and the URL is being assembled from it
Ojos AzulesOP
thank you for your help, but I still didn't find where the bug exactly is.
American black bear
try commenting out the css import
that could be causing the issue
@Ojos Azules Click to see attachment
Greek Shepherd
The global stylesheet shouldnt be in /src/app either way so the path is definitely wrong here
@American black bear that could be causing the issue
Ojos AzulesOP
I have tried this solution, but it doesn't soved it, the css import is marked as error due to eslint
Greek Shepherd
whats the error and where is the globals.css located
American black bear
paste this as your home page and see if it works then:
if this does not fix the problem try deleting .next and node_modules folders and reinstalling the dependencies with npm/pnpm/yarn/bun install
export default function HomePage() {
return <div>hello world</div>
}if this does not fix the problem try deleting .next and node_modules folders and reinstalling the dependencies with npm/pnpm/yarn/bun install
everything else looks correct