Sometimes when you try to install a React app you may get a long error that starts out like this:
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
You may also see the following bit of advice:
If prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project. That will permanently disable this
The most likely cause is that you accidentally installed a package in a folder above your project folder. For instance, if you are in
/home/projects/my-project you may have accidentally installed a package into
/home/projects at some point. This is easy to do if you are on the command line and try to install a package before changing into the project directory.
To resolve this,
cd ../ into the directory above and do
ls. Do you see an incorrectly placed
package.json? If so, delete both. Otherwise,
cd ../ and check again. Continue to do this until you find the errant installation.
Once the errant installation has been deleted, return to your project directory, delete the node_modules there and try your install again.
JS Bites Have you ever need a quick solution to a problem, but when you search Google you are met with pages of tutorials and detailed instructions that bury the information you need? That's what JS Bites attempts to solve. Each post is a small, bite-sized primer on a very specific JS topic. The aim is to provide enough detail to boost understanding, but not so much that you become overwhelmed or lost.