Next.js Discord

Discord Forum

Internal server error

Unanswered
Dwarf Crocodile posted this in #help-forum
Open in Discord
Dwarf CrocodileOP
When i try to access my website i get the image below. I also get no logs from the pnpm start command. Is there a way to enable logs for the app so i can see why i get the error?

31 Replies

Dwarf CrocodileOP
Ok sorry for not answering but i fixed it, i accidentally removed the compilerOptions.declaration option in my tsconfig which made typescript error, but now i get this error

Type error: The inferred type of 'alertVariants' cannot be named without a reference to '.pnpm/class-variance-authority@0.7.0/node_modules/class-variance-authority/types'. This is likely not portable. A type annotation is necessary.
39.28 
39.28   4 | import { cn } from "../../lib/utils";
39.28   5 |
39.28 > 6 | const alertVariants = cva(
39.28     |       ^
39.28   7 |   "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
39.28   8 |   {
39.28   9 |     variants: {
39.46  ELIFECYCLE  Command failed with exit code 1.
------
failed to solve: process "/bin/sh -c pnpm run build" did not complete successfully: exit code: 1
Dwarf CrocodileOP
Ok full context im running this in a docker container and it seems the wierd typescript error comes from running pnpm dlx prisma generate as it does not occur when i remove the second line here

RUN rm -rf node_modules && pnpm i
RUN pnpm dlx prisma generate
RUN pnpm run build
oh no, you don't need rm -rf node_modules && pnpm install if you are using docker
Dwarf CrocodileOP
I know i felt it was wierd but still my prisma generate is making my pnpm node modules invalid somehow
Could it be removing symlinks or something similar?
@Dwarf Crocodile Could it be removing symlinks or something similar?
have you tried remove the docker image and build again?
Dwarf CrocodileOP
yes i've done docker-compose down -v && docker-compose build --no-cache and it still gives the cva error
how many image do you see?
Dwarf CrocodileOP
7 disregarding mysql and one where the repository isn't <none>
Dwarf CrocodileOP
im sorry for my bad explination heres the docker image ls
auth-prod is my project
@Dwarf Crocodile im sorry for my bad explination heres the docker image ls
docker rmi 24 fb 14 76 e9 c6 3a
then try to build it again
Dwarf CrocodileOP
nope
@Dwarf Crocodile nope
try npm run build first
@Dwarf Crocodile nope
could you show your tsconfig.json?
Dwarf CrocodileOP
{
  "include": [
    "next-env.d.ts",
    "next.config.js",
    "**/*.js",
    "**/*.ts",
    "**/*.tsx",
    ".next/types/**/*.ts"
  ],
  "exclude": ["node_modules"],
  "$schema": "https://json.schemastore.org/tsconfig",
  "display": "Next.js",
  "compilerOptions": {
    "plugins": [{ "name": "next" }],
    "allowJs": true,
    "jsx": "preserve",
    "noEmit": true,
    "declaration": true,
    "declarationMap": true,
    "esModuleInterop": true,
    "incremental": false,
    "isolatedModules": true,
    "lib": ["es2022", "DOM", "DOM.Iterable"],
    "module": "NodeNext",
    "moduleDetection": "force",
    "moduleResolution": "NodeNext",
    "noUncheckedIndexedAccess": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "strict": true,
    "target": "ES2022"
  }
}
turning off declarations fixed the types issue but then in turn gives me the internal server error in nextjs during runtime
Dwarf CrocodileOP
nope
would it be better to just migrate to yarn, seems like a symlink issue with pnpm
Don't think this is worth the hassle
Dwarf CrocodileOP
I found this github issue which seems to line out my problem but most of them are quite specific https://github.com/microsoft/TypeScript/issues/47663#issuecomment-1519138189