• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

안녕하세요 npm 설정 시 오류가 발생하여 질문 남깁니다.

20.04.26 17:39 작성 조회수 4.91k

0

강의대로 따라하다가, 

npm run dev를 치고 엔터를 치는데,

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:

  /home/sj/node_modules/babel-jest (version: 25.3.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 "babel-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 /home/sj/node_modules/babel-jest is outside your project directory.

     For example, you might have accidentally installed something in your home folder.

  7. 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!

와 같은 에러가 뜨더라구요. 터미널에서 하라고 한대로 했는데, skip preflight check를 true 로 하면은 실행은 됩니다. 근데 이거는 일시적인 해결방법이라고 하더라구요.

skip preflight check=true로 하면 실행은 되는데, 터미널에는 이런 메세지가출력됩니다

[1] ./src/components/views/LandingPage/LandingPage.js

[1]   Line 2:10:  'FaCode' is defined but never used  no-unused-vars

[1] 

[1] ./src/components/views/LoginPage/LoginPage.js

[1]   Line 74:11:  'dirty' is assigned a value but never used        no-unused-vars

[1]   Line 79:11:  'handleReset' is assigned a value but never used  no-unused-vars

[1] 

[1] ./src/components/views/RegisterPage/RegisterPage.js

[1]   Line 92:11:  'dirty' is assigned a value but never used        no-unused-vars

[1]   Line 97:11:  'handleReset' is assigned a value but never used  no-unused-vars

[1] 

[1] Search for the keywords to learn more about each warning.

[1] To ignore, add // eslint-disable-next-line to the line before.

[1] 

[1] [HPM] Error occurred while trying to proxy request /api/users/auth from localhost:3000 to http://localhost:5000 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)

맨 아래의 2줄은 제외하곤 eslint 떄문에 일어나는 오류인 거 같은데, 맨 아래 2줄의 메세지가 어떤 뜻인지 잘 모르겠습니다. 도움 주시면 감사하겠습니다

답변 5

·

답변을 작성해보세요.

6

코딩왕님의 프로필

코딩왕

2020.06.18

에러가 발생했는데, 저같은 분이 계실까 싶어서 해결방법 메모 남깁니다. 

20/06/18

【에러 내용】

Error: Cannot find module 'C:\Users\Administrator\Documents\boilerplate-mern-stack\node_modules\bcrypt\lib\binding\bcrypt_lib.node'

Require stack:

- C:\Users\Administrator\Documents\boilerplate-mern-stack\node_modules\bcrypt\bcrypt.js

- C:\Users\Administrator\Documents\boilerplate-mern-stack\server\models\User.js

- C:\Users\Administrator\Documents\boilerplate-mern-stack\server\routes\users.js

- C:\Users\Administrator\Documents\boilerplate-mern-stack\server\index.js

    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)

    at Function.Module._load (internal/modules/cjs/loader.js:862:27)

    at Module.require (internal/modules/cjs/loader.js:1040:19)

    at require (internal/modules/cjs/helpers.js:72:18)

    at Object.<anonymous> (C:\Users\Administrator\Documents\boilerplate-mern-stack\node_modules\bcrypt\bcrypt.js:6:16)

    at Module._compile (internal/modules/cjs/loader.js:1151:30)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)

    at Module.load (internal/modules/cjs/loader.js:1000:32)

    at Function.Module._load (internal/modules/cjs/loader.js:899:14)

    at Module.require (internal/modules/cjs/loader.js:1040:19)

    at require (internal/modules/cjs/helpers.js:72:18)

    at Object.<anonymous> (C:\Users\Administrator\Documents\boilerplate-mern-stack\server\models\User.js:2:16)

    at Module._compile (internal/modules/cjs/loader.js:1151:30)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)

    at Module.load (internal/modules/cjs/loader.js:1000:32)

    at Function.Module._load (internal/modules/cjs/loader.js:899:14) {

  code: 'MODULE_NOT_FOUND',

  requireStack: [

    'C:\\Users\\Administrator\\Documents\\boilerplate-mern-stack\\node_modules\\bcrypt\\bcrypt.js',

    'C:\\Users\\Administrator\\Documents\\boilerplate-mern-stack\\server\\models\\User.js',

    'C:\\Users\\Administrator\\Documents\\boilerplate-mern-stack\\server\\routes\\users.js',

    'C:\\Users\\Administrator\\Documents\\boilerplate-mern-stack\\server\\index.js'

  ]

}

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! react-boiler-plate@1.0.0 start: `node server/index.js`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the react-boiler-plate@1.0.0 start script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

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

npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2020-06-18T10_40_06_821Z-debug.log

【에러 해결】

"bcrypt""^3.0.6",

bcrypt의 버전이 문제인듯 싶어서, 아래와 같이 변경

"bcrypt""^5.0.0",

하여 npm install 재 실행 해주면, 인스톨에 성공 하게 됩니다.

wisely_님의 프로필

wisely_

2021.11.21

은인이십니다.

1

그러면  한번 처음부터 해서 어디에서 에러가 생기는지 봐볼까요?  

먼저  그  create react app 처음부분만 다운받은후에  

npm run start 해서  react 가 잘 실행 되는지 볼수있을까요?

0

devsn님의 프로필

devsn

질문자

2020.05.09

답이 늦었네요!

지금은 해결한 상태입니다.

스택오버플로우와 계속된 구글링으로 결국 ^^...

같이 해결해주려 하셔서 정말 감사합니다

남은 강의, 마저 수강해 보겠습니다 ㅎㅎㅎ

0

devsn님의 프로필

devsn

질문자

2020.05.05

네..모든 경로에서 위의 것들을 다 해봤지만 안되네요.

유튜브강의도 보면서 하려고 했는데 유튜브쪽도 마찬가집니다. 아마 제 컴퓨터에 뭐가 잘못깔렸나봐요...그걸 못찾겠네요

.env를 쓰면 며칠전까지는 됐는데, 지금은 이렇게 해도 안되네요 ㅠㅠ

답변 감사합니다

0

안녕하세요  우선 전체적인 오류가 

babel-jest 이 부분에서 에러가 시작되서 

서버 연결이 제대로 안되서  그 이후 에러까지 생긴것 같은데요.

혹시 어떤 특별한 package를 다운 받으셨나요 ? 

아니라면  혹시 

1. node_module 제거 

2. babel jest 제거 

3. package-lock.json 제거 

4. npm install 로 모듈을 다시 받아 보고 해보시겠어요 ~ ?