Parsing error: No Babel config file detected for XXXXX

Parsing error: No Babel config file detected for XXXXX

1. The error is as follows:

insert image description here

insert image description here

2. The reason for the error

According to the parserOption of the eslint configuration file, eslint knows to use babel to parse the code, but parsing babel requires the use of the babel configuration file. Since the configuration file cannot be found (the babel configuration file needs to be placed in the root directory by default), an error will be reported. Therefore, adding requireConfigFile:
false essentially tells eslint that there is no need to search for this configuration file. Although this error can be solved on the surface, the things written in the babel configuration file will also be invalid.

Two, the solution

Method 1: The first solution I found by myself: Just open the project file with VScode to solve it. Find your project file and drag it to VScode to open it (use the project file as the root directory)

Method 2 : Some people say that the solution is to configure requireConfigFile: false, which essentially tells eslint that there is no need to find this configuration file for me, but I continued to check the information and saw that some bloggers said that this is only superficially true. This error can be solved, but what you wrote in the babel configuration file will be invalid. Later, I checked other information to solve this error.

Open it as the root directory in VSCode, I have successfully solved

insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/m0_46374969/article/details/130996392