반응형

 

🚀 Error log

Error: error:0308010C:digital envelope routines::unsupported

...

{
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v17.0.1

 

⚙️ 작업 환경

package.json

 

👨🏻‍💻 해결 과정

어느 날부터 갑자기 위와 같은 오류가 발생하기 시작하였는데 스택오버플로우나 구글링으로 검색 결과 Node.js 버전 17 이상을 제거하고 버전 16을 설치, 명령 프롬프트 창에서 노드 옵션으로 아래와 같이 붙여 넣기 등등을 해봤으나 해결되지 않았습니다.

Linux 및 Mac OS(Windows git bash)-

export NODE_OPTIONS=--openssl-legacy-provider

Windows 명령 프롬프트-

set NODE_OPTIONS=--openssl-legacy-provider

 

좀 더 찾아본 뒤 package.json의 scripts에서 start 명령어에 옵션을 주어 임시방편으로 해결하는 방법을 알아냈습니다.

"start": "react-scripts start"

에서

"start": "set NODE_OPTIONS=--openssl-legacy-provider && react-scripts start"

으로 변경

 

 

그러나 근본적인 문제를 해결하지는 못하였으므로 npx create-react-app으로 생성한 프로젝트로 실행해보니 잘 실행되어 두 프로젝트의 package.json 파일의 차이점을 분석하였고 react, react-dom, react-scripts 패키지를 하나하나씩 업그레이드해보면서 react-scripts의 버전 문제였다는 것을 알게 되었습니다.

 

 

🗝️ 해결 방법

react-scripts 버전 업그레이드

$ npm install --save react-scripts@5.0.1

 

 

 

 

 

 

반응형

+ Recent posts