본문 바로가기

React

[React] digital envelope routines 에러 해결법 - Node.js 버전 문제

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at module.exports (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:471:10)
    at /Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:503:5
    at /Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:358:12
    at /Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
/Users/user/Programming Documents/WebServer/untitled/node_modules/react-scripts/scripts/start.js:19
  throw err;
  ^

오랜만에 React 작업할게 생겨 yarn start를 하였다. 그런데 갑자기 상기와 같은 에러가 발생한 것이다.

 

당황했다. 뭐지..? 그래서 해당 문제에 대한 원인을 찾아보았다.

 

[ 오류 원인 설명 ]

https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported

 

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

I created the default IntelliJ IDEA React project and got this: Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHa...

stackoverflow.com

상기에 stack overflow 에서 해당 문제에 대한 원인을 찾았다.

 

원인은 단순했다. 현재 나의 node 버전이 LTS 상태여서 16 버전으로 Downgrade 시키라는 것이다.

 

나는 nvm 이라는 툴을 사용한다. nvm 은 node 버전관리하는데 있어서 정말 편리하다.

 

현재 내 nvm list 에는 노드 버전 v16.19.0, v18.12.1 이 있다. 

 

상기 오류의 원인은 내가 18.12.1 node 버전을 사용중이여서 발생한 것이다. 호환이 아직 잘 안돼있는 상태였던 것이다.

 

그래서 16.19.0 으로 버전을 낮춘뒤 yarn start 해보니 정상 실행 됐다.

 

nvm 이라는 기능에 대해서도 간단히 블로그 정리를 해봐야겠다.