Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- error
- CSS3
- 이클립스
- css
- npm
- java
- Eclipse Bug
- frontend
- Sass
- 이클립스 소스 비교 안보일 때
- next.js
- Study
- ref
- VW
- html
- gulp
- Eclipse Compare View
- 1분코딩
- Adobe
- 정적웹사이트
- tomcat
- SSR
- Eclipse
- 보일러플레이트
- TaskRunner
- React
- ref전달하기
- JavaScript
- animation
- 자바스크립트
Archives
- Today
- Total
프론트 개발 블로그
[Error] create-react-app / jest 설치 후 발생하는 에러 본문
jest 를 설치 후 npm start 혹은 yarn start 로 리액트를 브라우저에 띄우려고 할 때 아래와 같이 에러가 발생한다.
프로젝트 종속성 트리에 문제로 Create React App 의 버그는 아니고 앱에서 수정해야 한다고 나왔다.
해당 매뉴얼 대로 확인해보니 Create React App 으로 리액트를 설치 했을 때
react-scripts 패키지에 jest가 이미 설치되어 있어서 에러가 나고 있었다.
yarn run v1.22.1
$ 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:
"jest": "24.9.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:
C:\Users\work\clone-coding-react\movie_app_clone_2020\node_modules\jest (version: 26.5.3)
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 "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 C:\Users\work\clone-coding-react\movie_app_clone_2020\node_modules\jest is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls jest in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed 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!
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
github.com/facebook/create-react-app/blob/master/CHANGELOG-0.x.md#migrating-from-023-to-030
해결 방법
기존에 설치한 jest 패키지는 삭제시킨 뒤 package.json 파일에서 아래와 같이 test 설정을 해주면 된다.
// ...
"scripts": {
// ...
"test": "react-scripts test --env=jsdom"
}
반응형
'React' 카테고리의 다른 글
[Errer] name can no longer contain capital letters (0) | 2020.10.28 |
---|---|
What is StrictMode in React? (0) | 2020.10.27 |
[React] render가 두번씩 발생하는 문제 (0) | 2020.10.12 |
[Error] Warning: Each child in a list should have a unique "key" prop. (0) | 2020.10.12 |
[React] Props (0) | 2020.03.07 |