Getting the same issue but given an hour on it get the solution
When we run npm start then you got this kind of an error that is version related issues for this issue.
Go to node_modules folder:
Project->node_modules->react-scripts->package.json
check the package.json file
there you got : "babel-loader": "8.0.4"
first remove : babel-loader folder for Project->node_modules->babel-loader
and then run npm i [email protected] (it is depend on your version you can change it like : npm i [email protected]) after that may be you got webpack issue then follow same thing remvoe webpack from "Project->node_modules->webpack"
and reinstall npm i [email protected]
4.19.1* webpack's version it may be change..
Answer from Rawan-25 on Stack OverflowCircular errors about babel-loader when trying to launch app
webpack babel loader fails to compile jsx
Issue while creating build for React JS Application
reactjs - babel-loader not working, Unexpected token '<' - Stack Overflow
Getting the same issue but given an hour on it get the solution
When we run npm start then you got this kind of an error that is version related issues for this issue.
Go to node_modules folder:
Project->node_modules->react-scripts->package.json
check the package.json file
there you got : "babel-loader": "8.0.4"
first remove : babel-loader folder for Project->node_modules->babel-loader
and then run npm i [email protected] (it is depend on your version you can change it like : npm i [email protected]) after that may be you got webpack issue then follow same thing remvoe webpack from "Project->node_modules->webpack"
and reinstall npm i [email protected]
4.19.1* webpack's version it may be change..
Create a .env file in your project directory and include SKIP_PREFLIGHT_CHECK=true in the file.
When I run yarn dev I get the error that:
> ERROR in Entry module not found: Error: Can't resolve 'babel-loader' in...
Following this answer, I manually installed balel loader as a dev dependency. But then when I run yarn dev I get this:
Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-loader was detected higher up in the tree:
C:\Users\****\Sync\dev\myproject\node_modules\babel-loader (version: 8.2.5)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
-
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
-
Delete node_modules in your project folder.
-
Remove "babel-loader" from dependencies and/or devDependencies in the package.json file in your project folder.
-
Run npm install or yarn, depending on the package manager you use.
I go through those 4 steps, then run yarn dev again, and I get the first error again.
Anyone know what's going? Why isn't babel-loader being auto-installed as a dependency? (I checked in /node_modules and it's not there.)
Thanks very much in advance.
[ --- EDIT --- ]
package.json as follows:
{
"name": "foo",
"version": "0.1.0",
"private": true,
"dependencies": {
"@babel/runtime": "^7.15.4",
"@fortawesome/fontawesome-svg-core": "^1.2.35",
"@fortawesome/free-brands-svg-icons": "^5.15.4",
"@fortawesome/free-regular-svg-icons": "^5.15.4",
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@fortawesome/react-fontawesome": "^0.1.14",
"@primer/octicons-react": "^13.0.0",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"axios": "^0.21.1",
"axios-auth-refresh": "^3.2.1",
"core-js": "^3.15.2",
"express": "^4.17.1",
"express-favicon": "^2.0.1",
"js-cookie": "^2.2.1",
"moment": "^2.29.1",
"prop-types": "^15.7.2",
"query-string": "^7.0.1",
"rc-table": "^7.17.1",
"react": "^17.0.2",
"react-beautiful-dnd": "^13.1.0",
"react-collapse": "^5.1.0",
"react-confirm-alert": "^2.7.0",
"react-country-flag": "^2.3.1",
"react-date-picker": "^8.2.0",
"react-dates": "^21.8.0",
"react-dom": "^17.0.2",
"react-dotdotdot": "^1.3.1",
"react-hook-form": "^7.17.1",
"react-https-redirect": "^1.1.0",
"react-loading": "^2.0.3",
"react-modal": "^3.14.3",
"react-paginate": "^7.1.3",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.3",
"react-select": "^4.3.1",
"react-tabs": "^3.2.2",
"recharts": "^2.0.10",
"redux": "^4.1.0",
"redux-devtools-extension": "^2.13.9",
"redux-form": "^8.3.7",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"regenerator-runtime": "^0.13.9",
"styled-components": "^5.3.0",
"web-vitals": "^0.2.4"
},
"scripts": {
"webpack-dev-server": "webpack-dev-server",
"dev": "webpack-dev-server --mode=development ",
"prod": "webpack --mode=production",
"build": "webpack --config webpack.config.js",
"test": "react-scripts test",
"eject": "react-scripts eject",
"postinstall": "react-scripts build",
"start": "react-scripts start"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/core": "^7.14.8",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-transform-runtime": "^7.12.1",
"@babel/preset-env": "^7.14.8",
"@babel/preset-react": "^7.14.5",
"@welldone-software/why-did-you-render": "^6.2.0",
"babel-cli": "^6.26.0",
"babel-plugin-styled-components": "^1.13.2",
"html-webpack-plugin": "^4.5.2",
"path": "^0.12.7",
"webpack-cli": "^4.7.2"
}
}
You need babel presets to compile react and other ES6, ES7 features.
The list of required presets:
- latest
- react
- stage-0
Add this file as .babelrc to your root.
{
"presets": ["latest", "react", "stage-0"],
}
and do this installation
npm install --save-dev babel-preset-latest babel-preset-react babel-preset-stage-0
Now, run webpack. It should work!
You need to install the babel. That's the key for compiling the jsx files.
First install it:
npm i -D @babel/preset-react @babel/preset-env @babel/core babel-loader @babel/plugin-proposal-class-properties
And then create the following files, and set the configurations like the following
/
.babelrc
webpack.config.js
.babelrc file:
{
"presets": [
[ "@babel/preset-env", {
"modules": false,
"targets": {
"browsers": [
"last 2 Chrome versions",
"last 2 Firefox versions",
"last 2 Safari versions",
"last 2 iOS versions",
"last 1 Android version",
"last 1 ChromeAndroid version",
"ie 11"
]
}
} ],
"@babel/preset-react"
],
"plugins": [ "@babel/plugin-proposal-class-properties" ]
}
webpack.config.js file:
module.exports = {
...
module: {
rules: [
{
test: /\.js?$/,
exclude: /node_module/,
use: 'babel-loader'
},
]
}
};
Now run the webpack. It must work fine.
» npm install babel-loader
» npm install react-app-rewire-babel-loader