๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
IT-Engineering/TroubleShooting

Webpack ๋นŒ๋“œ ์—๋Ÿฌ 'ERR_OSSL_EVP_UNSUPPORTED' ํ•ด๊ฒฐ

by ๐Ÿงž‍โ™‚๏ธ 2024. 1. 12.
๋ฐ˜์‘ํ˜•

 

ParaView Glance๋นŒ๋“œ ์ค‘์— ์ƒ๊ธด ์˜ค๋ฅ˜๋‹ค.

 

https://github.com/Kitware/glance

 

GitHub - Kitware/glance: Kitware Glance is an open-source web application developed at Kitware for visualizing volumetric images

Kitware Glance is an open-source web application developed at Kitware for visualizing volumetric images, molecular structures, geometric objects, and point clouds. It is part of the ParaView platfo...

github.com

 

์—ฌ๊ธฐ์„œ ์•„๋ž˜์ฒ˜๋Ÿผ ํ•˜๋ผ๊ณ  ํ–ˆ๋Š”๋ฐ, ์˜ค๋ฅ˜๊ฐ€ ์ƒ๊ฒผ๋‹ค. 

$ git clone https://github.com/Kitware/glance.git
$ cd glance/
$ npm install
$ npm run build
$ npm run dev

 ์˜ค๋ฅ˜ ๋ฐœ์ƒ ๋ถ€๋ถ„

์˜ค๋ฅ˜๊ฐ€ ์ƒ๊ธด ๋ถ€๋ถ„์€ ์•„๋ž˜ ๋‘๊ตฐ๋ฐ๋‹ค.

$ npm run build
$ npm run dev

 

 ์˜ค๋ฅ˜ ๋ฐœ์ƒ ๋ชจ์Šต

npm run build

> glance@0.0.0-semantically-release build > webpack --config build/webpack.dev.config.js [webpack-cli] Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:68:19) at Object.createHash (node:crypto:138:10) at BulkUpdateDecorator.hashFactory (/Users/sark/dev/paraview/glance/node_modules/webpack/lib/util/createHash.js:155:18) at BulkUpdateDecorator.digest (/Users/sark/dev/paraview/glance/node_modules/webpack/lib/util/createHash.js:80:21) at /Users/sark/dev/paraview/glance/node_modules/webpack/lib/DefinePlugin.js:595:38 at _next26 (eval at create (/Users/sark/dev/paraview/glance/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:44:1) at _next4 (eval at create (/Users/sark/dev/paraview/glance/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:97:1) at Hook.eval [as call] (eval at create (/Users/sark/dev/paraview/glance/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:109:1) at Hook.CALL_DELEGATE [as _call] (/Users/sark/dev/paraview/glance/node_modules/tapable/lib/Hook.js:14:14) at Compiler.newCompilation (/Users/sark/dev/paraview/glance/node_modules/webpack/lib/Compiler.js:1053:26) { opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ], library: 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED' }

 

npm run dev

> glance@0.0.0-semantically-release dev > webpack-dev-server --config build/webpack.dev.config.js node:internal/crypto/hash:68 this[kHandle] = new _Hash(algorithm, xofLen); ^ Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:68:19) at Object.createHash (node:crypto:138:10) at BulkUpdateDecorator.hashFactory (/Users/sark/dev/paraview/glance/node_modules/webpack/lib/util/createHash.js:155:18) at BulkUpdateDecorator.digest (/Users/sark/dev/paraview/glance/node_modules/webpack/lib/util/createHash.js:80:21) at /Users/sark/dev/paraview/glance/node_modules/webpack/lib/DefinePlugin.js:595:38 at _next28 (eval at create (/Users/sark/dev/paraview/glance/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:40:1) at _next6 (eval at create (/Users/sark/dev/paraview/glance/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:97:1) at Hook.eval [as call] (eval at create (/Users/sark/dev/paraview/glance/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:113:1) at Hook.CALL_DELEGATE [as _call] (/Users/sark/dev/paraview/glance/node_modules/tapable/lib/Hook.js:14:14) at Compiler.newCompilation (/Users/sark/dev/paraview/glance/node_modules/webpack/lib/Compiler.js:1053:26) { opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ], library: 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED' }

 

 ์˜ค๋ฅ˜ ๋ฐœ์ƒ ์ด์œ 

์ด์œ ๋Š” ๋‚ด Node๋ฒ„์ „์ด ์ด ํ”„๋กœ์ ํŠธ์™€ ๋งž์ง€ ์•Š์•„์„œ๋‹ค. ๋‚ด๊ฐ€ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” ๋ฒ„์ „์€ v20.8.1์ด์—ˆ๋Š”๋ฐ, ๋Œ€๋žต ์ด ํ”„๋กœ์ ํŠธ๋Š” 17๋ฏธ๋งŒ์˜ ๋ฒ„์ „์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ ์ ˆํ•ด๋ณด์ธ๋‹ค.

์ด ์—๋Ÿฌ๋Š” ์ตœ์‹  ๋ฒ„์ „์˜ Node.js(ํŠนํžˆ Node.js 17 ์ด์ƒ)์—์„œ ๋ฐœ์ƒํ•˜๋Š” ๊ฒƒ์œผ๋กœ ๋ณด์ด๋ฉฐ, OpenSSL 3.0๊ณผ ๊ด€๋ จ๋œ ๋ณ€๊ฒฝ์œผ๋กœ ์ธํ•ด ํŠน์ • ์•”ํ˜ธํ™” ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ๊ธฐ๋ณธ์ ์œผ๋กœ ๋น„ํ™œ์„ฑํ™”๋œ ๊ฒƒ์ด ์›์ธ์ผ ๊ฐ€๋Šฅ์„ฑ์ด ๋†’๋‹ค. Node.js 17 ์ด์ƒ์—์„œ๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ๋ช‡๋ช‡ ์•”ํ˜ธํ™” ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ๋น„ํ™œ์„ฑํ™”๋˜์–ด ์žˆ์–ด, ์ด์™€ ๊ด€๋ จ๋œ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋Š” Webpack ๋˜๋Š” ๋‹ค๋ฅธ ํŒจํ‚ค์ง€์—์„œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋‹ค.

 

 ํ•ด๊ฒฐ์ฑ…

์•„๋ž˜์˜ ํ•ด๊ฒฐ์ฑ… ์ค‘ ํ•˜๋‚˜๋ฅผ ์‹œ๋„ํ•˜์—ฌ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋‹ค. ๋‚ด ๊ฒฝ์šฐ๋Š” Node ๋ฒ„์ „ ๋ณ€๊ฒฝ๋„ ๊ท€์ฐฎ๊ณ , ์ตœ๋Œ€ํ•œ ๋นจ๋ฆฌ ์‹คํ–‰์‹œํ‚ค๊ณ  ์‹ถ์–ด, 2๋ฒˆ์˜ ํŒจํ‚ค์ง€ ํŒŒ์ผ์„ ๊ฑด๋“œ๋ฆฌ๋Š” ๋ฐฉ์‹์œผ๋กœ ํ•ด๊ฒฐํ–ˆ๋‹ค. ํ”„๋กœ์ ํŠธ์˜ ์š”๊ตฌ ์‚ฌํ•ญ๊ณผ ํ™˜๊ฒฝ์— ๋”ฐ๋ผ ์ ํ•ฉํ•œ ๋ฐฉ๋ฒ•์„ ์„ ํƒํ•˜์‹œ๊ธธ. 3, 4๋ฒˆ์€ ์ถ”์ธก์„ฑ์ด๋ผ ์ฐธ๊ณ ๋งŒ ํ•˜์‹œ๊ธธ ๋ฐ”๋ž€๋‹ค.

1. Node.js ๋ฒ„์ „ ๋‹ค์šด๊ทธ๋ ˆ์ด๋“œ:
Node.js์˜ ์ด์ „ ๋ฒ„์ „(์˜ˆ: 16.x)์œผ๋กœ ๋‹ค์šด๊ทธ๋ ˆ์ด๋“œ. ์ด์ „ ๋ฒ„์ „์—์„œ๋Š” ํ•ด๋‹น ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ๋‹ค.

2. ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์„ค์ •:
Node.js์—์„œ OpenSSL 3.0๊ณผ ๊ด€๋ จ๋œ ๊ธฐ๋Šฅ์„ ๋‹ค์‹œ ํ™œ์„ฑํ™”ํ•˜๋ ค๋ฉด ํ™˜๊ฒฝ ๋ณ€์ˆ˜ NODE_OPTIONS๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. ํ„ฐ๋ฏธ๋„์—์„œ ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜๊ฑฐ๋‚˜, ํ•ด๋‹น ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋ฅผ ํ”„๋กœ์ ํŠธ์˜ npm ์Šคํฌ๋ฆฝํŠธ์— ์ถ”๊ฐ€ํ•œ๋‹ค:

export NODE_OPTIONS=--openssl-legacy-provider

๋˜๋Š” package.json์˜ ์Šคํฌ๋ฆฝํŠธ ์„น์…˜์— ๋‹ค์Œ๊ณผ ๊ฐ™์ด NODE_OPTIONS=--openssl-legacy-provider ๋ถ€๋ถ„์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋‹ค:

"scripts": {
"build": "NODE_OPTIONS=--openssl-legacy-provider webpack --config build/webpack.dev.config.js",
"dev": "NODE_OPTIONS=--openssl-legacy-provider webpack-dev-server --config build/webpack.dev.config.js",
}

3. Node.js ๋ฒ„์ „ ์—…๋ฐ์ดํŠธ:
ํ•ด๋‹น ๋ฌธ์ œ๊ฐ€ ์ˆ˜์ •๋œ Node.js์˜ ์ƒˆ ๋ฒ„์ „์ด ์žˆ๋‹ค๋ฉด, Node.js๋ฅผ ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ์—…๋ฐ์ดํŠธํ•œ๋‹ค. 

4. Webpack ๋ฐ ๊ด€๋ จ ์˜์กด์„ฑ ์—…๋ฐ์ดํŠธ:
Webpack๊ณผ ๊ด€๋ จ๋œ ์˜์กด์„ฑ์„ ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ์—…๋ฐ์ดํŠธํ•œ๋‹ค.


๋ญ ํ•˜๋‚˜ ํ•ด๊ฒฐํ•˜๋Š”๋ฐ, ํ•ญ์ƒ ์• ๋จน๋Š” ๊ฒŒ ์•„์ง ๋‚ด๊ณต์„ ํ•œ์ฐธ ๋” ์Œ“์•„์•ผ ํ• ๋“ฏ ์‹ถ๋‹ค. ํ™”์ดํŒ…!

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€