Next.js Discord

Discord Forum

Can't run with bun

Answered
Saltwater Crocodile posted this in #help-forum
Open in Discord
Saltwater CrocodileOP
any idea where's the problem?
running with bunx --bun next dev
Answered by Saltwater Crocodile
okay, i have reinstalled the project and it works now for some reason
View full answer

25 Replies

Whats in your package.json?
@Jboncz Whats in your package.json?
Saltwater CrocodileOP
im basically migrating my elysia project into a nextjs project
@Saltwater Crocodile any idea where's the problem? running with `bunx --bun next dev`
Just to check, does console.log({ Bun }) show Bun global, AND also can you try just bun --bun next dev (maybe you dont need the x)
Saltwater CrocodileOP
im free to send the project repository if you want
Saltwater CrocodileOP
oh it is defined actually
getting this now though
TypeError: undefined is not an object (evaluating 'this.add')
yeah intresting, all i will say is bun sometimes kinda works for nextjs but its not that good
@riský yeah intresting, all i will say is bun *sometimes kinda* works for nextjs but its not that good
Saltwater CrocodileOP
okay, i have reinstalled the project and it works now for some reason
Answer
Wow nice
@riský Wow nice
Saltwater CrocodileOP
hey btw can you help me with one more thing?
sure
Saltwater CrocodileOP
im making a docker image, but it for some reason doesnt work as it should
i run next build
but i get
they are present
i did copy the tsconfig
it will build succesfully if i install all dependencies
but if i install only required(without dev) it wont work
the package json:
{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "backend": "bunx prisma db push && bun src/app/api/[[...slugs]]/route.ts"
  },
  "dependencies": {
    "@elysiajs/eden": "^1.1.3",
    "@elysiajs/swagger": "^1.1.1",
    "@lucia-auth/adapter-prisma": "^4.0.1",
    "@prisma/client": "^5.19.1",
    "elysia": "^1.1.12",
    "lucia": "^3.2.0",
    "next": "14.2.8",
    "pino": "^9.4.0",
    "prisma": "^5.19.1",
    "react": "^18",
    "react-dom": "^18"
  },
  "devDependencies": {
    "@types/bun": "^1.1.8",
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "bun-types": "^1.1.26",
    "eslint": "^8",
    "eslint-config-next": "14.2.8",
    "eslint-config-prettier": "^9.1.0",
    "postcss": "^8",
    "prettier": "^3.3.3",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  }
}
im guessing that typescript is missing, so it doesnt pickup the custom config for module paths
@riský sure
Saltwater CrocodileOP
btw, i was wondering, if i build next build, do i still need node_modules?
if you are using standalone (a config you can enable in next.config.js) you only need to copy that folder (no need for node_modules)
but open another thread for this if you want as its very diferent to this one