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

Bun install is broken on v14.0.0 #57540

Closed
chuckstock opened this issue Oct 26, 2023 · 12 comments
Closed

Bun install is broken on v14.0.0 #57540

chuckstock opened this issue Oct 26, 2023 · 12 comments
Labels
bug Issue was opened via the bug report template. locked

Comments

@chuckstock
Copy link

Link to the code that reproduces this issue

https://github.com/chuckstock/nextjs-bun-install-bug

To Reproduce

  1. create a fresh nextjs app with 14
  2. Run bun install
  3. Run next dev

Error:

/Users/charlieblackstock/repos/bun-latest/node_modules/next/dist/server/web/spec-extension/request.js:28
class NextRequest extends Request {
                          ^

ReferenceError: Request is not defined
    at Object.<anonymous> (/Users/charlieblackstock/repos/bun-latest/node_modules/next/dist/server/web/spec-extension/request.js:28:27)
    at Module._compile (node:internal/modules/cjs/loader:1191:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
    at Module.load (node:internal/modules/cjs/loader:1069:32)
    at Function.Module._load (node:internal/modules/cjs/loader:904:12)
    at Module.require (node:internal/modules/cjs/loader:1093:19)
    at Module.mod.require (/Users/charlieblackstock/repos/bun-latest/node_modules/next/dist/server/require-hook.js:64:28)
    at require (node:internal/modules/cjs/helpers:108:18)
    at Object.<anonymous> (/Users/charlieblackstock/repos/bun-latest/node_modules/next/dist/server/web/spec-extension/adapters/next-request.js:37:18)
    at Module._compile (node:internal/modules/cjs/loader:1191:14)
    ```

### Current vs. Expected behavior

Dev doesn't run, it should run.

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Operating system: MacOS
Bun version: 1.0.7

Which area(s) are affected? (Select all that apply)

Not sure

Additional context

No response

@chuckstock chuckstock added the bug Issue was opened via the bug report template. label Oct 26, 2023
@chuckstock chuckstock changed the title Bun install is broken on 14 Bun install is broken on v14.0.0 Oct 26, 2023
@JoaquinBattilana
Copy link

I'm having the same problem with pnpm

@JoaquinBattilana
Copy link

In my case it was resolved by bumping the node version (i was using 16 and bumped to 20), seems like the minimum version was bumped in version 14 ( node 18.17 is the minimum)
https://nextjs.org/docs/pages/building-your-application/upgrading/version-14

@cosmictoby
Copy link

v16 support was dropped this release as per #56896

Bumped to 18.18.2 since it contained some security-related patches: https://nodejs.org/en/blog/vulnerability/october-2023-security-releases

@JesseKoldewijn
Copy link
Contributor

As @JoaquinBattilana mentioned, the minimal Node.js version was bumped to node 18.17. So this would mean that this kind of behavior might be expected.

@jilherme
Copy link

image

just need to upgrade node version to 18 or higher

@chuckstock
Copy link
Author

As @JoaquinBattilana mentioned, the minimal Node.js version was bumped to node 18.17. So this would mean that this kind of behavior might be expected.

Awesome this worked, thank you!

@agurumurthy96
Copy link

I followed the tutorial mentioned on the website - but as soon as I type npm run dev, I get the same error mentioned in this thread. I am using node version 18.17 which is the required version as per the Document. Can someone please help?
Screenshot 2023-10-28 at 3 08 25 AM

@jilherme
Copy link

I followed the tutorial mentioned on the website - but as soon as I type npm run dev, I get the same error mentioned in this thread. I am using node version 18.17 which is the required version as per the Document. Can someone please help? Screenshot 2023-10-28 at 3 08 25 AM

there must be something wrong with the node version.

I tried again but my system default version was running v16 and it gave the same error, so I changed to 18 and it worked. If you can provide a repo (if it's public) I can test to see if the problem is in your project, but prob not.

@agurumurthy96
Copy link

I have only used npx create-next-app@latest and then npm run dev, after which I received the error. Zero customization done, so not sure how sharing the repository would help in this case. FYI, I also modified the node version to 20 and tried running, but got the same error

@agurumurthy96
Copy link

I have only used npx create-next-app@latest and then npm run dev, after which I received the error. Zero customization done, so not sure how sharing the repository would help in this case. FYI, I also modified the node version to 20 and tried running, but got the same error

Screenshot 2023-10-28 at 3 49 10 AM

@JesseKoldewijn
Copy link
Contributor

I followed the tutorial mentioned on the website - but as soon as I type npm run dev, I get the same error mentioned in this thread. I am using node version 18.17 which is the required version as per the Document. Can someone please help?

Screenshot 2023-10-28 at 3 08 25 AM

Unrelated since issue is specifically about the bun package manager w/ outdated/incompatible node version.

But to solve your issue. Check the node version you're using and if you still get errors maybe remove the older versions of node from your system.

Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

No branches or pull requests

6 participants