The Problem
create-react-app initializes a repository where babel-loader is installed as an older version than needed.
LOG:
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App,
but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"babel-loader": "8.0.4"
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\user\node_modules\babel-loader (version: 8.0.2)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If 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:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
2. Delete node_modules in your project folder.
3. Remove "babel-loader" from dependencies and/or devDependencies in the package.json
file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix
the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
6. Check if C:\Users\User\node_modules\babel-loader is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls babel-loader in your project folder.
This will tell you which other package
(apart from the expected react-scripts) installed babel-loader.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reg#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reg#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Roaming\npm-cache\_logs\2018-12-13T18_22_47_802Z-debug.log
After what it happened
$ npx create-react-app reg && cd reg && npm start
What I've tried
I tried to remove node_modules folder and package-lock.json, then run npm install.
Also installed yarn and ran yarn && yarn start.
I've recreated the app 3 times and got the same result.
Info that may be helpful
Node version: 10.8.0
NPM Version: 6.5.0
create-react-app / react-scripts: 2.1.1
babel-loader: 8.0.4
Global packages list (npm ls --depth=0 -g):
+-- create-react-app#2.1.1
+-- node-gyp#3.6.2
+-- npm#6.5.0
+-- yarn#1.12.3
package.json file:
{
"name": "reg",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-scripts": "2.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
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 babel-loader#8.0.4 (it is depend on your version you can change it like : npm i babel-loader#8.0.5) after that may be you got webpack issue then follow same thing remvoe webpack from "Project->node_modules->webpack"
and reinstall npm i webpack#4.19.1
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.
On Mac:
Remove the conflicting package from /Users/<yourusername>/node_modules
However, a different version of babel-loader was detected higher up in the tree:
You should delete babel-loader package that was was detected higher up the tree. The output says there is a node_modules folder with babel-loader at..
C:\Users\user\node_modules\babel-loader (version: 8.0.2)
You may be able to delete the C:\Users\user\node_modules directory altogether as well, unless for some reason you have a project rooted there inside /Users/{user}
A few years later, the same issue.
For me, the solution was in my c:/users/myName/node_modules.
Remove that node_modules completely and try again.
You can momentarily downgrade react-scripts to 1.1.5 in the package.json file, then remove the node_modules folder and in the case of using NPM delete the package-lock.json file and in case Yarn delete the file yarn.lock.
After that, reinstall the dependencies and start the development server with the yarn start or npm run start command.
this means you install tow babel-loader
rm yarn.lock
run npm uninstall babel-loader#8.0.4
I got the same problem.
I solved it by removing folder node_modules in User/ and file package-lock.json (if exists).
It should work perfectly then.
I had this exact same issue. For anyone who finds this thread via Google and is a beginner like me. Here is exactly what to enter into your terminal(Mac User).
Say you're getting the same error that Paul was getting:
"The react-scripts package provided by Create React App requires a dependency:
"babel-loader": "8.0.6"
Here's what I entered into the terminal. I could be wrong, but this is what worked for me (I am also a beginner):
Step 1: Delete the node_modules folder as well as the package_lock.json files.
Step 2: In your terminal, type cd - (we're just getting outside of our project folder and going into your home folder)
Step 3: In your terminal type in npm i "dependency-name#number" so for the above example it would be: npm i babel-loader#8.0.6
Step 4: Now in your terminal, navigate into your project folder and type: npm install or yarn install
Step 5: Try running npm start and if all the issues have been solved, it should start the development server.
Note: I had to do the above process twice, for babel-loader#8.0.6 as well as for Webpack.
I have also problems after creating an app-project using the following commands:
create-react-app "project name"
create-react-app "project name" --use-npm
npx create-react-app.
On all cases the result was the error specified right in the top:
[There might be a problem with the project dependency tree. It is
likely not a bug in Create React App, but something you need to fix
locally.......][...]
watching on the error a line came with a small clue:
"/Users/john/node_modules/babel-loader (version: "7.1.5") -> was a
version that creates conflict with above specified - version
"babel-loader#8.0.6"
for me the solution was: following this path through my folders and delete the node_modules folder then restart again the project.
C:\Users\user\node_modules\babel-loader
Delete node_modules from \user\node_modules don't delete from your project
if you are using backend (nodejs) check if you are using webpack in your backend
make sure your create-react-app webpack and backend webpack version same
In the /home/<username>/node_modules/babel-loader directory just change in the package.json file the version to "8.0.4" in your case.
Worked for me
I got the same error with babel-loader#8.1.0, I removed the reference from package.json and also the module from node_modules and installed "npm i babel-loader#8.1.0" but then introduced #jest error.
I removed the #jest module from node_modules then installed the required dependency version as I did for babel-loader to solve the issue.
For me the same issue was resolved by adding "resolutions": {
"babel-loader": "8.1.0" //the required version
} in my package.json file.
Removed node-modules, yarn.loack, package-lock.json
yarn start
It worked perfectly fine
I was having this issue and just added in
"babel-loader": "8.0.4",
to my package.json in the dependencies and it seemed to fix the issue
Related
I have the following error with npm start in my React application:
The react-scripts package provided by Create React App requires a dependency:
"webpack-dev-server": "3.11.1"
Don't try to install it manually: your package manager does it automatically.
However, a different version of webpack-dev-server was detected higher up in the tree:
C:\Users\Username\node_modules\webpack-dev-server (version: 3.11.0)
Usually I fixed this type of issue by running the following code: npm install react-scripts#latest.
But now it seems like that React is not updated yet to the latest webpack-dev-server
Now the question is how to fix that. By the way, I use npx create-react-app for my project, Thanks!
I have write following commands in react project
Open project in command prompt
npm uninstall -g webpack-dev-server
remove web-dev-server folder from node_modules(C:/Users/UserName/Node_Modules)
npm i -g webpack-dev-server#3.11.1
remove package-lock.json and write npm install
after it your react project may be start by npm start
First, remove the node_modules folder and yarn-lock or package-lock.json file.
And, then add this line in your .env file:
SKIP_PREFLIGHT_CHECK=true
Now you can do npm start or yarn start after re-installing the packages. It should work.
Explanation:
For some reasons, you have two versions of webpack-dev-server installed in your project's node_modules. By setting SKIP_PREFLIGHT_CHECK=true in .env file, we are telling npm to ignore such version issues.
Check if node_modules and package-lock.json are present in your home folder, instead of your project folder. If yes, delete those two folders and then go for npm start.
i was trying to learn webpack and i have downloaded webpack-dev-server and i got this problem how to resolve this
frame#0.1.0 start
react-scripts start
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a
dependency:
"webpack": "4.44.2"
Don't try to install it manually: your package manager does it automatically.
However, a different version of webpack was detected higher up in
the tree:
C:\Users\jacob\node_modules\webpack (version: 5.24.2)
anually 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 "webpack" 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.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
Check if C:\Users\jacob\node_modules\webpack is outside your
project directory.
For example, you might have accidentally installed something
in your home folder.
Try running npm ls webpack in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed webpack.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above
:-) We hope you find them helpful!
npm ERR! code 1
npm ERR! path C:\Users\jacob\frame
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c react-scripts start
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jacob\AppData\Local\npm-cache_logs\2021-02-28T02_36_44_243Z-debug.log
You should not use your own webpack config with create-react-app. If you really want to do so, do yarn ejector npm eject. It will give you access to CRA's webpack config. If I were you, I'd just start a project from scratch by downloading React as a simple library, and set everything up with Babel + Webpack. It will be much easier to learn.
How to fix Could not find plugin "proposal-numeric-separator", I get this error when I try to build my React application, I have not ejected the application yet:
./src/index.js
Error: [BABEL] /home/pc/Downloads/project/src/index.js: Could not find plugin "proposal-numeric-separator". Ensure there is an entry in ./available-plugins.js for it. (While processing: "/home/pc/Downloads/project/node_modules/babel-preset-react-app/index.js$0")
at Array.map (<anonymous>)
at Generator.next (<anonymous>)
at Generator.next (<anonymous>)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I have tried to download Babel and the dependency Proposal Numeric Separator, remove the Node Modules, clean the Yarn cache; but nothing worked.
I'm using Yarn 1.22.4 and Node 13.11.0, but I have also tried with NPM 6.13.7.
The following steps work:
Add the following line to package.json:
"resolutions": {
"#babel/preset-env": "7.5.5"
},
Run the following command:
$ npx npm-force-resolutions
Install dependencies:
$ npm install
# or
$ yarn
Build your project:
$ yarn build
Take a look at this Github Issue
Try this, it works: npm i #babel/compat-data#7.8.0
I have just used it like 10 minutes ago, and it's working fine.
Related issue going on github about this. Click Here!
From the corresponding issue in create-react-app,
Update react-scripts to 3.4.1 in your package.json file and remove
node_modules as well as package-lock.json/yarn.lock and re-install.
Why this problem happened?:
It's an issue of conflicts between internal packages used by babel.
Adding a new plugin to #babel/compat-data breaks old #babel/preset-env versions. This is because preset-env iterates over compat-data's plugins, and throws if the plugin isn't defined in preset-env's available-plugins.js file.
This is the merge that fixed the issue: https://github.com/babel/babel/pull/11201/files/a88a00750c61ff89f1622d408d67108719f21ecd
Solution:
Delete package-lock.json or yarn.lock
Delete node_modules folder
In package.jon I have adjusted the version numbers of these packages to:
...
"devDependencies": {
"#babel/compat-data": "^7.8.0",
"#babel/preset-env": "^7.8.0",
"babel-loader": "^8.1.0",
...
},
...
"resolutions": {
"#babel/preset-env": "^7.8.0"
}
Run npm install
Run npm run build
Reference: https://github.com/angular/angular-cli/issues/17262
I found two solution
a ) Install babel compat
"devDependencies": {
"#babel/compat-data": "7.8.0",
}
b) Install plugin-proposal-numeric-separator
npm install --save-dev #babel/plugin-proposal-numeric-separator
install this version only 7.8.0
Angular CLI can create this kind of issue. Go to package json and change it to
build-angular": "0.803.17"
please don't add ^ or ~ .
I faced similar issue and i was able to fix it by updating all babel dependencies to latest version. I'm not aware of the exact issue with babel. However, the below mentioned step worked for me.
Step 1: identify and remove all babel related dependencies from package.json
npm remove #babel/runtime #babel/core #babel/plugin-proposal-class-properties #babel/plugin-transform-modules-commonjs #babel/plugin-transform-runtime #babel/preset-env #babel/preset-react babel-eslint babel-jest babel-loader
Step 2: re-install babel dependencies
npm install --save #babel/runtime
npm install --save-dev #babel/core #babel/plugin-proposal-class-properties #babel/plugin-transform-modules-commonjs #babel/plugin-transform-runtime #babel/preset-env #babel/preset-react babel-eslint babel-jest babel-loader
PS: The above list of babel dependencies will differ for your project.
I just changed react-script version from 3.0.1 to 3.4.1
You can use this command, which has worked for me.
npm i #babel/compat-data#7.8.0
I'm using angular & this worked for me, simply changed the version of #babel/compat-data from ^7.8.0 to just 7.8.0, the package-lock.json is having newer version which has bugs.
Inside package.json:
"devDependencies": {
"#babel/compat-data": "7.8.0",
}
In package.json
"dependencies": {
"#babel/compat-data": "7.8.0",
"#babel/plugin-proposal-numeric-separator": "^7.8.3",
"babel-loader": "^8.1.0",
....
"resolutions": {
"#babel/preset-env": "^7.8.7"
}
it is working for me. You can read more
https://github.com/angular/angular-cli/issues/17262#issuecomment-603396857
Its just a 4 step process.
Reason:
This happens because of a package missing in babel. This will happen even if you create angular app using ng new command.
Solution
Install plugin-proposal-numeric-separator using the following code in terminal.
npm install --save #babel/plugin-proposal-numeric-separator
Once it is done navigate to the file as shown below.
node_modules > #babel > preset-env > available-plugins.js
In available-plugins.js below exports.default = void 0; copy and paste the following code.
var _pluginProposalNumericSeparator = _interopRequireDefault(require("#babel/plugin-proposal-numeric-separator"));
In available-plugins.js within var _default object declaration copy and paste the following code.
"proposal-numeric-separator": _pluginProposalNumericSeparator.default,
And it is done.
In my angular 8 application, although I did not have any direct dependancy of react-scripts package and did not have it in package.json either but started getting this error on build. It was likely used as a depedancy by other packges.
By reading this post on github, I added it as dependancy in package.json "react-scripts": "3.4.1" and run npm install the build started working just fine.
This worked for me:
Delete package-lock.json
Delete node_modules
Run npm i
try this , this working with me .
npm i #babel/compat-data#7.8.0
Add SKIP_PREFLIGHT_CHECK=true to .env file to make the build work without ejecting and follow the below steps:
Delete node_modules and package-lock.json
Add "resolutions": { "#babel/preset-env": "^7.8.7" } to package.json
Run npm install npm-force-resolutions --save-dev
Run npm install
Run npx npm-force-resolutions
Run npm install again
Run npm run build
In my case I've got a corrupted node_modules folder.
My yarn install simply stopped in the middle by a power surge.
By running:
rm -rf node_modules
yarn
My problem was solved.
worked for me.
npm install #babel/compat-data#~7.8.0
I just had this happen to me. The To fix it I ran yarn build with sudo privileges.
All I am doing is running create-react-app and cd'ing into the app, then trying to run npm/yarn start. I get the following error/output/log. I have walked through all of the suggested steps. The only thing that works is the SKIP_PREFLIGHT_CHECK=true in my .env as the last resort for both
Yarn and npm. I have recently updated to Mojave and had to reinstall my Xcode if people have had a similar experience.
Last login: Tue Oct 30 16:30:24 on ttys002
TheLAB11:~ jasonspiller$ cd repos/react-express-graphql-app/
TheLAB11:react-express-graphql-app jasonspiller$ npm start
> react-express-graphql-app#0.1.0 start /Users/jasonspiller/repos/react-express-graphql-app
> react-scripts start
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"babel-jest": "23.6.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-jest was detected higher up in the tree:
/Users/jasonspiller/node_modules/babel-jest (version: 23.4.2)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If 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:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
2. Delete node_modules in your project folder.
3. Remove "babel-jest" from dependencies and/or devDependencies in the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
6. Check if /Users/jasonspiller/node_modules/babel-jest is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls babel-jest in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed babel-jest.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-express-graphql-app#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-express-graphql-app#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jasonspiller/.npm/_logs/2018-10-30T23_09_42_358Z-debug.log
I just had the same problem. For some reason the package ended up in a node_modules directory in my home directory. It also gave me the exact same error for the jest package.
I'm not sure of the correct way to fix this as npm uninstall -g babel-jest and yarn global remove babel-jest do not do anything.
I fixed it by just blowing away the folders that cause the problem:
bash
rm -rf ~/node_modules/babel-jest ~/node_modules/jest
It would be great to know how those packages ended up there, and the proper way of getting rid of them, but for now just deleting the folders is enough to get CRA dev server running without skipping the preflight check.
This problem can occur if there is node_modules in a parent directory of the folder where you run the application. I solved the problem by deleting the node_modules directory.
I too faced a similar problem and was able to resolve the issue following below steps.
Create a .env file in your project root directory and add the following statement
SKIP_PREFLIGHT_CHECK=true
Save the file
Remove node_modules, yarn.lock, package.lock
Then reinstall node_modules with
npm install
This should work
The problem seems to have reappeared in create-react-app 3.0.0.
The react-scripts package provided by Create React App requires a dependency:
"babel-jest": "24.7.1"
As abisuq pointed out in https://github.com/facebook/create-react-app/issues/6756#issuecomment-489562571 adding a version resolutions into package.json temporarily fixes the problem.
"resolutions": {
"babel-jest": "24.7.1"
},
Update: It has been fixed in create-react-app 3.0.1. If upgrading is an option you can run
npm install --save --save-exact react-scripts#3.0.1
or
yarn add --exact react-scripts#3.0.1
run: npm ls babel-jest
got : babelk-jest#24.7.1 & babel-jest#24.8.0 installed
this means install tow babel-jest with diff version
run:npm uninstall babel-jest#24.8.0 fix my issue
I had this issue and finally solved it easily.
As probably you know, when we use create-react-app, Jest is configured by default and you don't need to install Jest (when we use Webpack, we can install Jest). So, if you use Create-react-app and install Jest by mistake:
Firstly uninstall it (remember that if you use: (npm install --save-dev jest), you can remove jest directly from Package.json or use: (npm uninstall --save-dev jest)
Delete package-lock.json (not package.json)
Delete the node_modules
npm install
Now you don't receive an error and you can easily use: (npm start) or (npm test)
Also, It is worth mentioning that I installed the following tools to write my test in React component:
(npm install --save-dev enzyme enzyme-adapter-react-16 jest-enzyme)
and wrote my test by using jest and enzyme. Then I easily use: (npm test)
Good Luck!
Ok I finally found a solution after trying everything. Here is what finally worked:
First of all, read the error message in the cmd from the beginning. They'll tell you what module is causing the problem. You probably have an older version installed on your computer. Example: babel-jest version 2.4.4
Go to your Node.js folder c:/Users/(your user)/node_modules and find that module and simply delete it.
Go back to the cmd and run npm start. You might get the same error. But it'll be for a different module. Just delete it the same way and repeat until it runs.
I fixed the issue by removing the node_modules folder and package-lock.json file from a folder that was higher than the root of the project. I had installed node_modules accidentally in a higher folder.
I had:
desktop/code/node_modules (remove this to fix)
desktop/code/package-lock.json (remove this to fix)
desktop/code/project/node_modules
desktop/code/project/package-lock.json
I was having this issue as well. When I tried to run the client using npm start, the error would occur, telling me that it required babel-jest: ^24.9.0.
I noticed that in my client, babel-jest was version ^24.9.0, but in my server, I had "jest": "^26.6.3".
All I had to do was change "jest": "^26.6.3" to "jest": "^24.9.0" in the server side source code, delete my package-lock.json as well as node_modules in server, npm install again, and good to go!
At first I installed these (my react version was "^17.0.2")
npm install --save-dev jest
npm install --save-dev enzyme enzyme-to-json
npm install #wojtekmaj/enzyme-adapter-react-17
After that, I had the same problem.
Then I did these steps :)
Added '.env' file in my project root directory and add:
SKIP_PREFLIGHT_CHECK=true
Removed node_modules & package.lock
npm install
npm start
I had the exact same issue.
What I tried was to create the react app outside the directory that had the node_modules folder.
After that, started the app with yarn start and didn't have the error anymore.
I had the same problem, and I fixed this issue. For some reason because node_modules on my local. I removed babel-jest & jest. After that, npm start. I'm not sure this solved incorrect but this correct for me.
I solved this issue by deleting the node_modules folder and package-lock.json file I accidentally had installed in the root of my user.
For me in Mac the path was:
Macintosh HD -> Users -> "My-user-name"
I discover that might be the problem by running npm ls babel-jest on terminal. That showed me that there was another babel-jest up in the tree.
After deleting these two I did npm install in my app where I previously had deleted the node_modules folder and package-lock.json.
Now it's running ok !
I fixed this by deleting node_module folder in the project directory
try this command and see which packages create conflicts in versions.
npm ls babel-jest
replace the conflicted packages with updated one of that package.
I tried all of written solutions above. But none of them worked. I solved problem by deleting "C:\node_modules" folder.
Then delete project node_modules and package-lock.json. Finally, npm install and start again. And it worked.
My react-scripts version is 4.0.3. The problem suddenly happened after installing a private remote package, which installed multiple babel packages in my project root's node_modules. I solved this by installing the problematic packages on the project root's level explicitly, so that they match the versions reported in the preflight check.
Following addings fixed it in my case. Your needed packages and versions may differ, you have to check the preflight report.
yarn add babel-jest#^26.6.0
yarn add babel-loader#8.1.0
For me its still a workaround, but i prefer this way instead of removing something in node_modules manually as suggested in https://stackoverflow.com/a/53093421/4840661.
This is the approach without deleting node_modules:
I recieved error like:
The react-scripts package provided by Create React App requires a dependency:
"jest": "26.6.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of jest was detected higher up in the tree:
First check the versions using:
npm ls babel-jest
In my case output was like this:
jest#27.0.3
└─┬ #jest/core#27.0.3
└─┬ jest-config#27.0.3
└── babel-jest#27.0.2
After that uninstall babel-jest by
npm uninstall babel-jest
(When you see the single version of babel-jest,otherwise go as versions as follows)
npm uninstall babel-jest#27.0.2
Then install required dependencies using
npm i babel-jest#version jest#version
(Where version is the one come in 1st point)
This works for me like a charm. Hope this solves you too.
Got this error in the netlify ci, here's the fix that worked for me:
this method works for any lib i got a error for eslint instead of babel-jest.
force the error to be shown by npm i -s #babel-jest/VERSION --force
replace VERSION with whatever version shows in the error(23.6.0 in this case),
the correct error message will be shown locally
use https://www.npmjs.com/package/npm-check-updates to upgrade your package.json flie with the correct versions
run ncu -u in dir of package.json after installing the npm package
globally
finally do a npm ci
this will delete the package-lock and node_modules and install the new versions based on the second step
this work for me.
clear caches in npm or yarn
remove node_modules and lock files
create .env file
add " SKIP_PREFLIGHT_CHECK=true " to an .env file in your project.
my issue was that I have both frontend and backend that I am running concurrently. I installed jest to my root project (for backend) and I guess there is collision with pre-installed react jest. I just uninstalled jest from backend and voila I am happy now. I don't have anything related with babel.
i had the similar problem and wasted my 2-3 days
The easiest way to solve this problem is :
1.go outside of src, and create .env file.
2.Inside .env file, just write this single line and save it:
SKIP_PREFLIGHT_CHECK=true
3.then npm start
Hope this helps, Happy coding!!!
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"eslint": "5.6.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of eslint was detected higher up in the tree:
D:\chintu\blog-exambunker-master\blog-exambunker-master\node_modules\eslint (version: 5.6.1)
how to install the version 5.6.0 I am installing the eslint it always gets installed with the latest version, can someone suggest me what to do?
The error is an incompatibility between eslint and babel-eslint versions. To do solve this, firstly you need to remove your eslint package using npm uninstall eslint. This command will delete your eslint package. After this, you need to install the 5.6.0 version of eslint, so write this command npm i eslint#5.6.0. I hope that this will be helpful for you. Also, you can delete your node_modules folder and then install it.
(Do not do what I did if you don't read everthing I posted) At least with me, I just downgraded my eslint 5.8.0 to 5.6.0 (manually). Why? Because when I use some eslint library like airbnb, it installs the latest version of eslint (5.8.0) automatically, the problem here is that this version has conflict with the previous eslint version used by react (5.6.0), so when you downgrade, you just return to the previous eslint installed, so it's working fine here, but you've to be careful when you update your react version.
I searched where the eslint was with:
npm ls eslint
then I deleted it with:
npm uninstall ls eslint
Finally I ran
npm start
and it worked.
Create a file .env in your root directory.
And you can ignore the check by putting
SKIP_PREFLIGHT_CHECK=true
in .env file.
Ref: https://github.com/facebook/create-react-app/issues/5247#issuecomment-427221678
Edit: This is not the solution to this problem. It is just to ignore the error as it is discussed in the issue.
I have the exactly same problem. I have tried everithing from those Suggestions:
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
Delete node_modules in your project folder.
Remove eslint 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.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
If you used npm, install yarn and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
Check if C:\Users\User\node_modules\eslint is outside your project directory.
For example, you might have accidentally installed something in your home folder.
Try running npm ls eslint in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed eslint.
nothing worked. every time I am doing npm install/yarn it keeps install the old version of eslint.
ok I find my issue: I had npm packeges and some more crap outside the projects folders (on c:/users/user) they may had the old version of eslint. cheack it out and tell me if you still have the problem or not.
I deleted a node modules folder that contained an older version of eslint. I found this to be the easiest solution rather than changing dependencies.
What solved this for me, was that in the error message, it told me that there was eslint installed in project with 5.6.0 and another installed in users/andrew/nodemodules/eslint with a version of 4.1.6 I tried doing a npm uninstall -g eslint but that didnt work so then I just searched for all the files and folders within users/andrew/nodemodules/eslint
and deleted them, and it worked for then.
I'm not sure if this is a good way to do it, but its worked.
Simple delete package-lock.json and node_modules then run npm install then
npm start
else you could install
npm i eslint#5.6.0 then
npm start
enjoy your work :)
List item
Open a NEW terminal window within root.
Run the command
npm ls eslint
this should show you the installations that are 'higher' up the dependency tree.
Navigate into the folder(s) that contain gulp-eslint/eslint/babel-eslint or even a sneaky node_modules/ that shouldn't have been installed globally.
Next, run either or all of these commands depending on where the files are situated.
rm -rf node_modules/
rm -rf (name of other folders like eslint/gulp-eslint)
RETURN TO YOUR PROJECT
Better to be safe than sorry, run the following commands to make sure it will work properly again.
Within the root directory of your project
rm -rf node_modules/
rm -rf package-lock.json
(If it didn't remove the node_modules just delete it from your folder)
Finally, Run the following.
npm install
then
npm start
go to node_modules folder and open react-scripts/package.json , find the eslint dependencies and change it. its fixed this way.
https://github.com/wesbos/eslint-config-wesbos/issues/17
In the above mentioned link they suggested to install #abhijithvijayan/eslint-config as peer dependency. See if this works for you.
you might install a global eslint like this
{22:14}~/go/src/github.com ➭ npm ls eslint
/Users/demon
└── eslint#6.1.0
then run
{22:14}~/go/src/github.com ➭ npm uninstall eslint
in the global terminal instead of vscode's terminal. then run
npm start
I just used this command: "npm uninstall eslint". Later I just ran mu=y code using npm run start and it worked. I did not have to delete or edit any file
Add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"eslint": "5.6.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of eslint was detected higher up in the tree:
/Users/macbook/node_modules/eslint (version: 3.19.0)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If 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 "eslint" 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.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
Check if /Users/macbook/node_modules/eslint is outside your project directory.
For example, you might have accidentally installed something in your home folder.
Try running npm ls eslint in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed eslint.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app#0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/macbook/.npm/_logs/2018-11-01T15_26_42_405Z-debug.log