Skip to content
New issue

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

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

Already on GitHub? # to your account

rt.toLowerCase is not a function on fresh next js init #64465

Closed
AkipTsaqif opened this issue Apr 14, 2024 · 27 comments
Closed

rt.toLowerCase is not a function on fresh next js init #64465

AkipTsaqif opened this issue Apr 14, 2024 · 27 comments
Labels
bug Issue was opened via the bug report template. locked

Comments

@AkipTsaqif
Copy link

Link to the code that reproduces this issue

https://github.com/AkipTsaqif/next-js-init-error

To Reproduce

  1. do npx create-next-app@latest and follow the steps as usual
  2. do npm run dev
  3. next js runs but produces error on the terminal, saying rt.toLowerCase is not a function at \node_modules\next\dist\compiled\webpack\bundle5.js:30:274042

Current vs. Expected behavior

next js should not produces those error

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 32704
  Available CPU cores: 6
Binaries:
  Node: 20.11.1
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.2.1 // Latest available version is detected (14.2.1).
  eslint-config-next: 14.2.1
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.5
Next.js Config:
  output: N/A

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

App Router

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

next dev (local)

Additional context

based on this SO question, that just been asked recently, this happens on next js 14.2

@AkipTsaqif AkipTsaqif added the bug Issue was opened via the bug report template. label Apr 14, 2024
@kobysysouvanh

This comment was marked as off-topic.

@abdulkareemolumoh

This comment was marked as off-topic.

@jovar-dev

This comment was marked as off-topic.

@Oelshehawi

This comment was marked as off-topic.

@madrosir

This comment was marked as off-topic.

@PolGubau

This comment has been minimized.

@timneutkens
Copy link
Member

timneutkens commented Apr 15, 2024

Hey everyone, I've had a look at the reproduction repository but I'm unable to trigger the same error. We tried both macOS, Windows, and Codesandbox but it doesn't trigger. It'd be helpful to get more information than "same issue" for this, to let people know you're running into the same issue you can use the GitHub 👍 feature. Posting "same issue" is not taken into account when sorting issues by how many people are running into them.

Is everyone that commented on this issue using Windows? Something else? Which version of Node.js? Tip: you can run next info to get this information.

@rawic
Copy link

rawic commented Apr 15, 2024

Hi,
I am also experiencing this issue with the rt.toLowerCase is not a function error when running yarn dev in a project. Here’s the output from running next info in my environment, which might help in identifying any commonalities causing this problem:

Version: Windows 11 Pro Education
  Available memory (MB): 32702
  Available CPU cores: 16
Binaries:
  Node: 20.11.0
  npm: N/A
  Yarn: 1.22.17
  pnpm: N/A
Relevant Packages:
  next: 14.2.1 // Latest available version is detected (14.2.1).
  eslint-config-next: 14.2.1
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.3
Next.js Config:
  output: N/A
Done in 1.84s.

Additionally, I've found that rolling back to Next.js version 14.1.4 resolves this issue.

@husen1003
Copy link

husen1003 commented Apr 15, 2024

I am also getting the same issue:

Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Available memory (MB): 15973
Available CPU cores: 8
Binaries:
Node: 20.11.1
npm: N/A
Yarn: N/A
pnpm: 8.7.5
Relevant Packages:
next: 14.2.1 // Latest available version is detected (14.2.1).
eslint-config-next: 14.2.1
react: 18.2.0
react-dom: 18.2.0
typescript: 5.4.5
Next.js Config:
output: N/A

@Hugo-Delattre

This comment was marked as spam.

@alexanderwford
Copy link

I'm also having this issue

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 131017
  Available CPU cores: 16
Binaries:
  Node: 21.6.2
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.2.1 // Latest available version is detected (14.2.1).
  eslint-config-next: 13.5.6
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.5
Next.js Config:
  output: N/A

@Poylar
Copy link

Poylar commented Apr 15, 2024

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
  Available memory (MB): 16307
  Available CPU cores: 16
Binaries:
  Node: 20.9.0
  npm: N/A
  Yarn: N/A
  pnpm: 8.15.5
Relevant Packages:
  next: 14.2.1 // Latest available version is detected (14.2.1).
  eslint-config-next: 14.2.1
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.4
Next.js Config

downgrade to 14.1.2 not fixed the problem, only 14.0.2 fixed

@alexanderwford
Copy link

Disabling the Console Ninja VS Code Extension fixed this for me.

@hacking-impossible
Copy link

Seems like Next.js 14.2 version doesn't support Console Ninja VS Code Extension.
Oh, Maybe Console Ninja VS Code Extension need to update fit to Next.js 14.2 version.

@pwglownia
Copy link

pwglownia commented Apr 15, 2024

You guys are brilliant, it really seems to be connected to Console Ninja extension.

@watercubz
Copy link

I have the same error when trying to create an api in version 14.2.1 of nextjs, in the api/hello/hello.ts path it tells me that there was an error with the webpack compiler
imagen_2024-04-15_184715125

@user-222002
Copy link

im also facing this issue....

@PrinzEugen39
Copy link

Hello, so im new developer here with minimum experience. Can you tell me how to recognize problem like this? Like how did we found that console ninja was the source of this problem

@CarrettaRiccardo
Copy link

CarrettaRiccardo commented Apr 16, 2024

Disabling the Console Ninja VS Code Extension fixed this for me.

After disabling Console Ninja, clean .next and node_modules and reinstall dependencies to work.
It seems like to happen again when installing a new dependency and Console Ninja is enabled.

balazsorban44 added a commit that referenced this issue Apr 16, 2024
### What?

Make sure that more unhelpful comments get minimized by default so issue
threads are easier to read.

### Why?

#64465

### How?

Using https://github.com/balazsorban44/nissuer#handle-unhelpful-comments

NOTE: This has the potential to hide comments that _might_ be useful,
but currently it looks like it is too permissive.

Closes NEXT-3107
@timneutkens
Copy link
Member

timneutkens commented Apr 16, 2024

Seems that the Console Ninja extension changes the internals of all frameworks, i.e. it changes Next.js internals to preload code. The code of their extension is heavily mangled and can't be audited -- seems like a security risk.

Was able to confirm it adds additional code to Next.js internals and that's why it's breaking:

CleanShot 2024-04-16 at 11 26 57@2x

To be clear: this is editing your node_modules when you have the extension is running.

That type of changing internals is going to break between any version really, not just for Next.js but for any framework that extension supports.

I'd like to avoid having to add integrity checks for core files to Next.js as it's quite slow. Guess we'll have to add a big warning to Next.js when console ninja is detected 😓

@mohammednazim007

This comment was marked as spam.

@ArtemGovorov
Copy link

ArtemGovorov commented Apr 16, 2024

Hi, Console Ninja extension team member here. I can confirm the issue was caused by the patch Console Ninja makes in order to support Next.js. Apologies for the inconvenience caused by the broken patch.

As soon as the issue has been brought up to our attention, we have fixed it in less than an hour, the extension version 1.0.306 should be working with the latest version of Next.js.

@timneutkens The behaviour of patching modules in order to make the extension features work is described in the extension docs. Typically, our patches to other tools are quite small and only include our loader at the start of a tool entry file. Unfortunately, with Next.js that packs its own minified version of webpack, it is slightly harder for us. Regarding the obfuscated code of the extension - while we offer a free version of the tool for everyone, it's a closed source project that also has a commercial Pro edition. And while every closed source software is a potential security risk as it can't be audited, it's worth noting that Wallaby Team (the company behind the extension and a couple more popular dev tools, such as Quokka and Wallaby) has been on the market since early 2015 for ~9.5 years, with over a million of users (both free and paid, including about 100,000 Next.js users in 1.5 years of Console Ninja only) trusting our tools to get more productive.

We have also shipped a new version of the patch that should not break Next.js if it fails to apply and will point to Console Ninja in case of any issues.

@AkipTsaqif
Copy link
Author

As soon as the issue has been brought up to our attention, we have fixed it in less than an hour, the extension version 1.0.306 should be working with the latest version of Next.js.

Finally thank you! At first I thought this is a Next Js issue since it doesn't mention anything about anything other than the webpack itself.

@timneutkens
Copy link
Member

@ArtemGovorov thanks for the additional explanation 🙏 I think it would be very helpful if you add a warning / log somewhere to ensure that people are aware that Console Ninja has edited the internals of a framework and might break the framework. I.e. seems a similar issue happened with SvelteKit and they weren't able to figure out the problem for a while as well: sveltejs/kit#10252

@ArtemGovorov
Copy link

@timneutkens Great idea, thanks! Apart from making sure our patches should not break target tools, we went ahead and added/released the following message to all CLI tools we integrate with:

Screenshot 2024-04-17 at 11 09 58 AM

(the URL describes the behaviour of patching modules, and how to quickly undo it).

@timneutkens
Copy link
Member

Awesome, thank you!

Copy link
Contributor

github-actions bot commented May 1, 2024

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 added the locked label May 1, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

No branches or pull requests