Parsing error: Cannot find module 'next/babel'

Parsing error: Cannot find module 'next/babel'

Fix it in 1 minute, no coding (not joking).

Understanding the Problem

The "Parsing error: Cannot find module 'next/babel'" error message commonly occurs when working with separate frontend and backend folders within a parent folder, let's call it "myapp." When attempting to open the entire "myapp" folder in Visual Studio Code, this bug is triggered, resulting in the error message mentioned.

For example, let's say you have a project structured with a "myapp" folder containing a "frontend" folder for the frontend code and a "backend" folder for the backend code. If you open the "myapp" folder directly in Visual Studio Code, you may encounter the "Parsing error: Cannot find module 'next/babel'" bug.

Solving the error

To resolve this issue, follow these two easy steps:

  1. Launch Visual Studio Code.

  2. Instead of opening the entire "myapp" folder, open the "frontend" folder in one window and the "backend" folder in another window.

By following these steps, you can resolve the "Parsing error: Cannot find module 'next/babel'" bug when working with, for example, separate frontend and backend folders in Visual Studio Code.