jh.nrtv

Error- npm start 불가 에러 - There might be a problem with the project dependency tree. 본문

Error

Error- npm start 불가 에러 - There might be a problem with the project dependency tree.

wlgus3 2023. 1. 3. 15:49

npm 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:

  "eslint": "^7.11.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/kimjihyeon/node_modules/eslint (version: 8.31.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  /Users/sangminpark/Desktop/React/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.

 내용 읽어보니 프로젝트 내의 'eslint'모듈 버전과 프로젝트 외에 'eslint'모듈 버전이 맞지 않아서 발생하는 문제인 듯 함 

시키는대로 1~부터 진행해 봐도내 실수인지 잘 되지 않는 것을 확인 

 

 

프로젝트 내에서 아래 명령어 시도 후 

npm ls eslint  //설치된 eslint 확인

npm uninstall eslint --save	 //프로젝트 내 eslint 삭제하고 package.json에서도 삭제

다시 npm start 해도 동일증상

 

 

해결

 

결국 프로젝트 외부에 깔린 eslint를 프로젝트가 요구하는 eslint의 버전과 동일하게 만들기 위해서

바탕화면 터미널에서 삭제 후 재설치 

 

MacBookAir ~ % npm ls eslint //eslint 버전 확인

MacBookAir ~ % npm uninstall eslint		//삭제 

MacBookAir ~ % npm install eslint@7.11.0	//버전 설정 후 재설치

 

 

 

 

 


 

 

+참고링크

 

There might be a problem with the project dependency tree. 관련 에러 해결하기

리액트에 typescript(타입스크립트)를 사용하기 위해서 이것 저것 모듈을 다운받고, 여러 문서들을 읽으면...

blog.naver.com