admin管理员组文章数量:1426219
I've tried installing jest for testing react apps
After installing them with yarn, I'm unable to start my react app any way
I'm getting the below message, but it didn't work.
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": "^24.9.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:
C:\Users\YV\node_modules\babel-jest (version: 27.0.5)
Manually installing inpatible 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-jest" 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\YV\node_modules\babel-jest is outside your project directory. For example, you might have accidentally installed something in your home folder.
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!
I've tried installing jest for testing react apps
After installing them with yarn, I'm unable to start my react app any way
I'm getting the below message, but it didn't work.
Share Improve this question asked Jul 6, 2021 at 19:47 yvdevyyvdevy 251 gold badge2 silver badges8 bronze badges 2There 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": "^24.9.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:
C:\Users\YV\node_modules\babel-jest (version: 27.0.5)
Manually installing inpatible 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-jest" 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./) 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\YV\node_modules\babel-jest is outside your project directory. For example, you might have accidentally installed something in your home folder.
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!
- Does this answer your question? NPM start returns error, "There might be a problem with the project dependency tree" – ponury-kostek Commented Jul 6, 2021 at 19:50
- no, it didn't work – yvdevy Commented Jul 6, 2021 at 20:56
2 Answers
Reset to default 1I just had the same issue and fixed it. So, you probably installed jest globally on accident. In doing so, it likely ended up installed inside of users/yourname/node-modules/
. If you can pull up a terminal, try doing a cd
into node-modules
from your home folder then do a ls -a
. If you see babel-jest
, do a rm -r babel-jest
and rm -r jest
. This fixed the problem for me. I'm running Linux, but the same strategy should work on Windows (not sure if the mands are exactly the same).
You probably installed a different global (npm install -g) version that is currently conflicting with the one you installed in your project.
You can quite literally delete the folder babel-jest
inside C:\Users\YV\node_modules\
and try again. I would assume you're doing this by using create-react-app. Rest assured that Jest is already part of the installed dependencies (hence the message pointing to package-lock.json
).
本文标签: javascriptHow to uninstall jest globallyStack Overflow
版权声明:本文标题:javascript - How to uninstall jest globally? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745464623a2659478.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论