Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run Next.js app with bun dev #723

Closed
nemanjastanic opened this issue Jul 15, 2022 · 5 comments
Closed

Unable to run Next.js app with bun dev #723

nemanjastanic opened this issue Jul 15, 2022 · 5 comments
Labels
bug Something isn't working ecosystem Something that relates to package or framework compatibility

Comments

@nemanjastanic
Copy link

nemanjastanic commented Jul 15, 2022

Version

0.1.4

Platform

Linux ballpoint 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

What steps will reproduce the bug?

  1. Use the package.json and tsconfig.json provided below.
  2. Run Next with bun dev.
  3. Upon opening the page the following error occurs:
➜  CSUnrealEdition git:(experiment/use-bun) bun dev
[0.01ms] ".env.local"
[2.00ms] bun!! v0.1.4


  Link: http://localhost:3000


Possibly incompatible Next.js version:  12.2.2 . Please upgrade to Next.js 11.1.2 or Next.js 12.0.2+.

[109.25ms] Next.js ready! (powered by bun)

SegmentationFault at 24


–––– bun meta ––––
Bun v0.1.4 Linux x64 #1 SMP Wed Mar 2 00:30:59 UTC 2022
DevCommand: tsconfig_paths fast_refresh tsconfig filesystem_router framework public_folder dotenv bunfig 
Elapsed: 4534ms | User: 78ms | Sys: 22ms
RSS: 90.19MB | Peak: 103.50MB | Commit: 90.19MB | Faults: 0
–––– bun meta ––––

Ask for #help in https://bun.sh/discord or go to https://bun.sh/issues

package.json:

{
  "name": "nextapp",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "svgr": "npx @svgr/cli -d src/components/icons --ignore-existing --icon --typescript public/static/icons",
    "build:analyze": "ANALYZE=true yarn build",
    "lint": "eslint '**/*.{js,jsx,ts,tsx}'",
    "prettier": "prettier --write '**/*.{js,jsx,ts,tsx}'",
    "prepare": "husky install"
  },
  "dependencies": {
    "@next/bundle-analyzer": "^12.2.2",
    "@react-spring/web": "^9.5.0",
    "@storyofams/next-password-protect": "^1.7.0",
    "@tiptap/extension-image": "^2.0.0-beta.30",
    "@tiptap/extension-task-item": "^2.0.0-beta.37",
    "@tiptap/extension-task-list": "^2.0.0-beta.29",
    "@tiptap/extension-typography": "^2.0.0-beta.22",
    "@tiptap/react": "^2.0.0-beta.114",
    "@tiptap/starter-kit": "^2.0.0-beta.191",
    "axios": "^0.27.2",
    "chalk": "^5.0.1",
    "classnames": "^2.3.1",
    "dayjs": "^1.11.3",
    "locomotive-scroll": "^4.1.4",
    "mongoose": "^6.4.4",
    "mongoose-beautiful-unique-validation": "^7.1.1",
    "mongoose-paginate-v2": "^1.7.0",
    "nanoid": "^4.0.0",
    "next": "^12.2.2",
    "next-compose-plugins": "^2.2.1",
    "next-optimized-images": "^2.6.2",
    "next-themes": "^0.2.0",
    "next-translate": "^1.0.1",
    "pluralize": "^8.0.0",
    "prettier": "^2.2.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-locomotive-scroll": "^0.2.0",
    "react-use": "^17.4.0",
    "reading-time": "^1.5.0",
    "remixicon": "^2.5.0",
    "sass": "^1.32.5",
    "slugify": "^1.6.5",
    "swr": "^1.3.0",
    "tailwindcss": "^3.1.6"
  },
  "devDependencies": {
    "@next/eslint-plugin-next": "^12.2.2",
    "@svgr/cli": "^6.2.1",
    "@tailwindcss/typography": "^0.5.3",
    "@types/mongoose": "^5.11.97",
    "@types/node": "^18.0.3",
    "@types/pluralize": "^0.0.29",
    "@types/react": "^18.0.15",
    "@types/react-dom": "^18.0.6",
    "@typescript-eslint/eslint-plugin": "^5.30.5",
    "@typescript-eslint/parser": "^5.30.5",
    "autoprefixer": "^10.4.7",
    "eslint": "^8.19.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-prettier": "^4.2.1",
    "husky": "^8.0.0",
    "lint-staged": "^13.0.3",
    "postcss": "^8.4.14",
    "bun-framework-next": "^12",
    "typescript": "latest"
  },
  "lint-staged": {
    "*.{js,jsx,ts,tsx}": [
      "yarn lint --quiet --fix"
    ]
  }
}

tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "baseUrl": ".",
    "paths": {
      "@pages/*": ["pages/*"],
      "@pages": ["pages"],
      "@components/*": ["src/components/*"],
      "@components": ["src/components"],
      "@public/*": ["public/*"],
      "@public": ["public"],
      "@styles/*": ["src/styles/*"],
      "@styles": ["src/styles/index.scss"],
      "@components/icons/*": ["src/components/icons/*"],
      "@components/icons": ["src/components/icons"],
      "@utils/*": ["src/utils/*"],
      "@utils": ["src/utils"],
      "@models/*": ["src/models/*"],
      "@models": ["src/models"],
      "@i18n": ["i18n.js"]
    },
    "incremental": true
  },
  "include": [
    "next-env.d.ts",
    "src/utils/db/global.d.ts",
    "**/*.ts",
    "**/*.tsx"
  ],
  "exclude": ["node_modules"]
}

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

The application doesn't crash.

What do you see instead?

The application crashes.

Additional information

I've had a good experience with Bun so far, which is why I decided to give it a go and use Bun in this project. Unfortunately, it didn't work out of the box. Thanks for your work!

@FrameMuse
Copy link

FrameMuse commented Jul 24, 2022

I think this is a problem with bun in general. It successfully works with react project created by bun itself but not with already existing one.

@SelfMadeSystem
Copy link

Might've been fixed in latest bun version.

With those specific package.json and tsconfig.json in the same directory and nothing else, running bun v0.1.11 didn't segfault (just 404s when accessing localhost:3000 as expected). I'm on Arch Linux 5.19.7-zen2-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Mon, 05 Sep 2022 18:33:28 +0000 x86_64 GNU/Linux

@FrameMuse
Copy link

FrameMuse commented Sep 12, 2022

@SelfMadeSystem I have tested it - it still doesn't work.

@github-actions github-actions bot removed the crash label Oct 22, 2022
@Electroid Electroid added ecosystem Something that relates to package or framework compatibility and removed needs repro Needs an example to reproduce labels Nov 2, 2022
@tonioloewald
Copy link

I'm using a bun-created project (not React) and bun dev is crashing a LOT (not 100%—it usually survives one or two hmr refreshes). It seems to be correlated with large files (one of my test libraries is a dictionary of English words, and that made things fragile, I then added a fairly hefty glb (binary 3d data) scene for a different stress test and it got even worse.

It's frustrating because bun dev works so nicely when it works, but now it's an active PITA.

@paperdave
Copy link
Collaborator

the old dev server bun dev was removed. related; the real next.js 13 pages router should work now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ecosystem Something that relates to package or framework compatibility
Projects
None yet
Development

No branches or pull requests

7 participants