Problem with the project dependency tree. Start project error
See original GitHub issueHi, all!
I created the project using:
npx create-react-app my-app
yarn create react-app my-app
npm init react-app my-app
I can’t start my react app, but I am getting the following error:
here 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.41.5"
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\<user>\node_modules\webpack (version: 4.39.0)
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:
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 "webpack" 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\webpack is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. 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!
I already tried the steps, but it didn’t solve
Did you try recovering your dependencies?
Yes
Environment
npx create-react-app --info
Environment Info:
current version of create-react-app: 3.4.0
running from C:\Users\<user>\AppData\Roaming\npm\node_modules\create-react-app
System:
OS: Windows 10 10.0.18362
CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Binaries:
Node: 12.16.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.21.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.11.3 - C:\Users\<user>\AppData\Roaming\npm\npm.CMD
Browsers:
Edge: 44.18362.449.0
Internet Explorer: 11.0.18362.1
npmPackages:
react: ^16.13.0 => 16.13.0
react-dom: ^16.13.0 => 16.13.0
react-scripts: 3.4.0 => 3.4.0
npmGlobalPackages:
create-react-app: Not Found
npm ls webpack
-- react-scripts@3.4.0
`-- webpack@4.41.5
Steps to reproduce
- npx create-react-app my-app
- cd my-app && npm start or yarn start
- error is triggered
More information
Package.json
{
"name": "fire-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-scripts": "3.4.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
There might be a problem with the project dependency tree. It ...
There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you...
Read more >HOW DO I FIX THIS ERROR : r/reactjs - Reddit
There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you...
Read more >Unable to resolve dependency tree error in Angular while ...
It's a dependency conflict (incorrect and potentially broken dependency) error, so run the command with --force or --legacy-peer-deps flag.
Read more >How to resolve create-react-app babel-jest Error. - Medium
There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you...
Read more >Viewing and debugging dependencies - Gradle User Manual
Project configurations are resolved in the settings file. In most cases, this issue can be resolved by creating a cross-project dependency on the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@schen3 @Fab2295 I tried this solution and this is working for me I haven’t explored any other solution. Skip is required there are some dependencies in new create-react-app like webpack which is causing an issue.
@Aakashdeveloper Why need to skip preflight check? Do you know any other solution instead of disable the preflight check.