• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

npm run start 에러질문

21.04.16 05:45 작성 조회수 230

0

PS C:\Users\KHS\Desktop\web_class\mern\client> npm run start

> client@0.1.0 start

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

  "webpack": "4.44.2"

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\KHS\Desktop\web_class\mern\node_modules\webpack (version: 5.27.2)

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\KHS\Desktop\web_class\mern\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!

npm ERR! code 1

npm ERR! path C:\Users\KHS\Desktop\web_class\mern\client

npm ERR! command failed

npm ERR! command C:\Windows\system32\cmd.exe /d /s /c react-scripts start

npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\KHS\AppData\Local\npm-cache\_logs\2021-04-15T20_44_19_476Z-debug.log

이렇게뜨는데요 저기서 제시해준 1~4번부터는 시도해봤습니다만 같은에러가 뜹니다

답변 3

·

답변을 작성해보세요.

0

Namlulu님의 프로필

Namlulu

2021.07.11

0

Namlulu님의 프로필

Namlulu

2021.07.11

안녕하세요 해결방법 알려드릴게요!

디렉토리를 server / client로 나눠서 해보시면 해결됩니당

0

일단 CRA 내장된 것과 뭔가 수동으로 새로 설치한 것이 충돌나면 이런 에러 잘 납니다. 

이 에러는 1번따라 하시고, node-modules파일 모두 지워줍니다.

그리고 나서 package.json은 https://github.com/sideproject0214/blog/blob/master/client/package.json

보시고

현재까지 라이브러리 설치된 것들의 버전을 맞춰주시면 해결가능할 것입니다. 

예> 단지 예시일뿐입니다.

(수강생 package.json )

"sass-loader": "11.0.1"

(싸플  package.json )

"sass-loader": "8.0.2"

이 경우 본인의 버전을 "0.19.2"로 수정해준다.