npm ์˜ค๋ฅ˜ ๋ฉˆ์ถฐ!! ๐Ÿ–๏ธ

๊น€์œ ์ง„ยท2023๋…„ 3์›” 18์ผ
1
post-thumbnail

์ •๋ง ์ •๋ง ๋’ค๋Šฆ๊ฒŒ .. GDSC์—์„œ ์Šคํ„ฐ๋””๋กœ ์ง„ํ–‰ํ–ˆ๋˜ ํŽ˜์ด์ง€ ๋ฐฐํฌ๋ฅผ ๋งˆ๋ฌด๋ฆฌ์ง€์—ˆ๋‹ค. ์ตœ์ข… ๋ชฉํ‘œ๊ฐ€ ํ”„๋กœ์ ํŠธ๋ฅผ ๋งˆ๋ฌด๋ฆฌ์ง“๊ณ  github ํŽ˜์ด์ง€๋กœ ๋ฐฐํฌ๋ฅผ ๋งˆ๋ฌด๋ฆฌํ•˜๋Š” ๊ฒƒ์ด์—ˆ๊ธฐ ๋•Œ๋ฌธ์— ๋ฐฐํฌ๋ฅผ ํ•˜๋ ค๊ณ  Npm ์„ธํŒ…์„ ์ด๊ฒƒ์ €๊ฒƒ ๋งˆ๋ฌด๋ฆฌํ•˜๋ ค๊ณ  ์กฐ๊ธˆ ๊ณ ์ƒ์„ ํ–ˆ๋‹ค.

2022๋…„ 9์›”์— ์‹œ์ž‘ํ•œ ํ”„๋กœ์ ํŠธ์ด๊ธฐ๋„ ํ•˜๊ณ  ํ•ด์„œ, node๋‚˜ React๋ฒ„์ „์ด๋‚˜ ๋‹ค๋ฅธ ํŒจํ‚ค์ง€ ๋“ฑ๋“ฑ๋„ ๋ฒ„์ „์ด ๋งž์ง€ ์•Š๋Š” ๊ฒƒ์ด ๋งŽ์•„์„œ gh page ํŒจํ‚ค์ง€๋ฅผ ๊นŒ๋Š” ๋ฐ์—๋„ ์ •๋ง ๋งŽ์€ ์‹œ๊ฐ„์ด ๋“ค์—ˆ๋‹ค.
์ด๋ฒˆ ๊ธ€์—์„œ๋Š” ๋‚ด๊ฐ€ ๋งˆ์ฃผ์ณค๋˜ Npm ์„ธํŒ… ์˜ค๋ฅ˜๋“ค๊ณผ ๊ทธ์— ๋Œ€ํ•œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ์ž‘์„ฑํ•˜๊ณ ์ž ํ•œ๋‹ค.

1. ๋ฒ„์ „ ์˜ค๋ฅ˜

๋จผ์ €, githubํŽ˜์ด์ง€๋กœ ๋ฐฐํฌํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋ฐฐํฌ๋ฅผ ์œ„ํ•œ gh page ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ด์ฃผ์–ด์•ผ ํ•œ๋‹ค.

npm install --save gh-pages

ํ•˜์ง€๋งŒ ์„ค์น˜๋ฅผ ํ•˜๊ธฐ๋งŒ ํ•˜๋ฉด, ์•„๋ž˜์™€ ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.

๋‚ด๊ฐ€ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” ๊ฒƒ์€ React ๋ฒ„์ „ 18.2.0 ์ด์—ˆ๋Š”๋ฐ, ๋‚ด๊ฐ€ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” ํŒจํ‚ค์ง€๋“ค์ด React ๋ฒ„์ „๊ณผ ๋งž์ง€ ์•Š์•„์„œ ์˜ค๋ฅ˜๊ฐ€ ๊ณ„์† ๋ฐœ์ƒํ•˜์˜€๋‹ค.
์œ„ ์‚ฌ์ง„์€ ๋ฒ„์ „ ์˜ค๋ฅ˜ ์˜ˆ์‹œ ํ™”๋ฉด์ด๋‹ค.

์˜ˆ์‹œ ํ™”๋ฉด์—์„œ ๋ณด์ด๋“ฏ์ด, react-virtualized ์™€ ๊ฐ™์€ ํŒจํ‚ค์ง€๋Š” ํŠน์ • React ๋ฒ„์ „์„ ์š”๊ตฌํ•˜๋Š”๋ฐ react๊ฐ€ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ํŒจํ‚ค์ง€๋Š” ์ด์™€ ๋งž์ง€ ์•Š์•„์„œ ๋ฐœ์ƒํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋ฉด ๋ณด๋ผ์ƒ‰์œผ๋กœ ํ•˜์ด๋ผ์ดํŠธ ๋˜์–ด peer ๋ผ๊ณ  ์ž‘์„ฑ๋œ ๋ถ€๋ถ„์ด ์žˆ๋‹ค. ์ด๊ฒƒ์€ ๋ฐ”๋กœ peerDependencies๋ผ๋Š” ๊ฑด๋ฐ, ๋‚˜์˜ ํŒจํ‚ค์ง€๊ฐ€ ๋‹ค๋ฅธ ํŒจํ‚ค์ง€์˜ ํŠน์ • ๋ฒ„์ „๊ณผ ํ˜ธํ™˜๋œ๋‹ค๋Š” ๊ฒƒ์„ ๋œปํ•œ๋‹ค.

์ฒ˜์Œ์—๋Š” ํ•ด๋‹น ํŒจํ‚ค์ง€์™€ ๋ฒ„์ „์„ ๋งž์ถ”๊ธฐ ์œ„ํ•˜์—ฌ ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•˜์—ฌ ํ•ด๊ฒฐ์„ ํ•ด ๋ณด๋ ค๊ณ  ํ•˜์˜€๋‹ค.
npm install react@^16.8.0 react-dom@16.8.0
ํ•˜์ง€๋งŒ, ์ด๋ ‡๊ฒŒ ๋ฒ„์ „์„ ๊ฐ•์ œ๋กœ ๋งž์ถœ ์ˆ˜๋ก ๋‹ค๋ฅธ ํŒจํ‚ค์ง€์— ๋Œ€ํ•œ ๋ฒ„์ „์ด ๋‹ค์‹œ ๊ผฌ์ด๊ฒŒ ๋˜๊ณ , ์˜์กด์„ฑ์„ ๋งˆ์Œ๋Œ€๋กœ ๋ณ€๊ฒฝํ–ˆ๋‹ค๊ฐ€๋Š” react-dom์— ๋Œ€ํ•œ ์˜์กด์„ฑ๋„ ๋ชจ๋‘ ๊ผฌ์ด๊ฒŒ ๋˜์–ด์„œ ์ฐธ ๊ณจ์น˜๊ฐ€ ์•„ํ”„๊ฒŒ ๋œ๋‹ค...๐Ÿฅน

๊ทธ๋Ÿผ ์–ด๋–ป๊ฒŒ ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์„๊นŒ?

npm6 ๋ฒ„์ „๊นŒ์ง€๋Š” ์ด๋Ÿฌํ•œ ํ˜„์ƒ์— ๋Œ€ํ•˜์—ฌ Warn๋ฉ”์„ธ์ง€๋งŒ ๋ณด์˜€๋Š”๋ฐ, ์ด์ œ 7๋ฒ„์ „๋ถ€ํ„ฐ๋Š” peer dependencies ์ž๋™ ์„ค์น˜๊ฐ€ ์ง„ํ–‰๋˜์–ด, ๋งž์ง€ ์•Š๋Š” ํŒจํ‚ค์ง€์— ๋Œ€ํ•˜์—ฌ ์‹ค์ œ ์—๋Ÿฌ๋ฉ”์„ธ์ง€๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ฐธ ํ•ด๊ฒฐํ•˜๊ธฐ ํž˜๋“  ๊ฒƒ ๊ฐ™๋‹ค. ๊ทธ๋ž˜๋„ ํ•ด๊ฒฐ์„ ํ•ด์•ผ ๋‹ค์Œ ๋‹จ๊ณ„๋กœ ๋„˜์–ด๊ฐˆ ์ˆ˜ ์žˆ์œผ๋‹ˆ ๊ผญ ์ •๋ฆฌํ•ด์•ผ ํ•˜๋Š” ๋ฌธ์ œ์ด๋‹ค.

ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์€ ๋‘๊ฐ€์ง€๋กœ ์ •๋ฆฌํ•  ์ˆ˜ ์žˆ๊ฒ ๋‹ค.
1. --force ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•œ๋‹ค.
2. --legacy-peer-deps ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•œ๋‹ค.

๊ทธ๋Ÿผ ๋‘๊ฐ€์ง€ ๋ช…๋ น์–ด์˜ ์ฐจ์ด์ ์€ ๋ฌด์—‡์ด๋ฉฐ, ๊ทธ ๋‘˜์€ ์–ด๋–ค ๊ธฐ๋Šฅ์„ ํ•˜๊ณ  ์žˆ์„๊นŒ?
๋จผ์ €, --force ๋ช…๋ น์–ด์— ๋Œ€ํ•œ ์ •๋ฆฌ์ด๋‹ค.

force๋ฅผ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋ฉด ์ถฉ๋Œ์„ ์šฐํšŒ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋Š”๋ฐ, peer dependency๋“ค์„ ๋ฃจํŠธ ํ”„๋กœ์ ํŠธ์— ์„ค์น˜ํ•˜์—ฌ ์—๋Ÿฌ๋ฅผ ํ•ด๊ฒฐํ•œ๋‹ค. ํ•„์š”ํ•œ ๊ฒฝ์šฐ ํŒจํ‚ค์ง€ ์˜์กด์„ฑ์„ ์œ„ํ•ด ์ถ”๊ฐ€์ ์ธ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ๋‹ค.

๋‹ค์Œ์œผ๋กœ, --legacy-peer-deps ๋ช…๋ น์–ด๋Š” ์–ด๋–ค ์—ญํ• ์„ ํ•˜๋Š”์ง€ ์•Œ์•„๋ณด์ž.

peerDependency๊ฐ€ ๋งž์ง€ ์•Š์•„๋„, ๊ทธ๊ฒƒ์„ ๋ฌด์‹œํ•˜๊ณ  ์„ค์น˜ํ•œ๋‹ค.

๋ณดํ†ต --force๋ฅผ ์‚ฌ์šฉํ•˜์˜€์„ ๋•Œ, ๋” ํ•„์š”ํ•œ ์˜์กด์„ฑ์„ ์ถ”๊ฐ€๋กœ ์„ค์น˜ํ•ด์ฃผ๊ธฐ ๋•Œ๋ฌธ์— ๋จผ์ € force ๋ฅผ ์ด์šฉํ•˜์—ฌ ์„ค์น˜๋ฅผ ์‹œ๋„ํ•ด ๋ณด๊ณ , --legacy-peer-deps ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์„ค์น˜๋ฅผ ์‹œ๋„ํ•ด ๋ณด๋Š” ๊ฒƒ๋„ ์ข‹๋‹ค.
๋‚˜๋Š” ํ›„์ž๋ฅผ ์ด์šฉํ•˜์—ฌ ์„ฑ๊ณต์ ์œผ๋กœ gh-page ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ ์™„๋ฃŒํ•˜์˜€๋‹ค.

2. envelope unsupported !

์„ค์น˜๋ฅผ ์ž˜ ํ•˜๊ณ , npm run deploy ๋ฅผ ํ•˜๋‹ˆ ์ด๋Ÿฐ ์—๋Ÿฌ๋ฅผ ๋งˆ์ฃผ์ณค๋‹ค.
๋‹ค๋ฅธ ์—๋Ÿฌ๋“ค์„ ๋งŒ๋‚˜ ์ด๋ฏธ ๋„ˆ๋œ๋„ˆ๋œํ•ด์ ธ ์žˆ์—ˆ๋˜ ๋‚˜๋Š” ๊ทธ๋งŒ..๐Ÿคทโ€โ™€๏ธ
๊ทธ๋ž˜๋„ ์ด ์‚ฐ์„ ๋„˜์–ด์•ผ ํ•œ์ธต ๋” ๋‹จ๋‹จํ•ด์ง€๋Š” ๊ฒƒ ์•„๋‹ˆ๊ฒ ์œผ์š” ๐Ÿ•ต๏ธ ํ•˜๊ณ  ์”ฉ์”ฉํ•˜๊ฒŒ ๋˜๋‹ค์‹œ ์—๋Ÿฌ๋ฅผ ํ•ด๊ฒฐํ•˜๋Ÿฌ ์ถœ๋ฐœํ–ˆ๋‹ค..

์ฒ˜์Œ์— ์—ฌ๋Ÿฌ ๋ธ”๋กœ๊ทธ๋“ค์„ ๋‹ค ์ฝ์–ด๋ณด์•˜์„ ๋•Œ์—๋Š” Node์˜ ๋ฒ„์ „์ด ๋„ˆ๋ฌด ๋†’์•„์„œ ์ด๋ฅผ ๋‹ค์šด๊ทธ๋ ˆ์ด๋“œ ํ•ด์•ผ์ง€ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ๋ง์ด ๋งŽ์•˜๋‹ค.
ํ•˜์ง€๋งŒ ํ˜„์žฌ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” Node ๋ฒ„์ „์€ LTS์ด๊ธฐ๋„ ํ•˜๊ณ ,(์Šคํƒ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ๊ฐœ๋ฐœ์ž๋“ค๋„ LTS ๋ฒ„์ „ ๋…ธ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ผ๊ณ  ํ–ˆ๋‹ค!) ๋งŒ์•ฝ ๋‹ค์šด๊ทธ๋ ˆ์ด๋“œ๋ฅผ ํ•œ๋‹ค๊ณ  ํ•ด๋„ ์–ด๋Š ๋ฒ„์ „๊นŒ์ง€ ๋‚ด๊ฐ€ ๋ฒ„์ „์„ ๋‚ด๋ ค์•ผ ํ•˜๋Š”์ง€ ์ž˜ ๋ชจ๋ฅด๊ฒ ๊ธฐ ๋•Œ๋ฌธ์— ๋ง‰๋ง‰ํ•œ ์ƒ๊ฐ์ด ๋“ค์—ˆ๋‹ค.

๊ทธ๋Ÿผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•œ ๊ทผ๋ณธ์ ์ธ ์›์ธ์„ ํƒ์ƒ‰ํ•ด๋ณด์ž.

๊ทธ๊ฒƒ์€ ๋ฐ”๋กœ ๋…ธ๋“œ 17, 18๋กœ ์—…๋ฐ์ดํŠธ๊ฐ€ ๋˜๋ฉด์„œ OpenSSL๊ณผ์˜ ํ†ต์‹ ์— ์žˆ์–ด ๋ฐ”๋€ ์ ์ด ๋งŽ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. ๊ทธ๋ž˜์„œ ๋…ธ๋“œ 16๋ฒ„์ „์œผ๋กœ ๋กค๋ฐฑํ•ด์„œ ํ•ด๊ฒฐํ•œ ๋ถ„๋“ค์ด ๋งŽ์€ ๊ฒƒ ๊ฐ™์€๋ฐ.. ๋…ธ๋“œ 18์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ณ  ์‹ถ์—ˆ๋‹ค.

์•„๋ž˜ ๊ธ€์€ stackoverflow์—์„œ ๋ฐœ์ทŒํ•œ ๊ธ€์ด๋‹ค.

In Node.js v17, the Node.js developers closed a security hole in the SSL provider. This fix was a breaking change that corresponded with similar breaking changes in the SSL packages in NPM. When you attempt to use SSL in Node.js v17 or later without also upgrading those SSL packages in your package.json, then you will see this error.

SSLํŒจํ‚ค์ง€๊ฐ€ package.json์—์„œ ์ตœ์‹  ์ƒํƒœ๊ฐ€ ์•„๋‹ ๋•Œ์—์„œ SSL์„ ์‚ฌ์šฉํ•˜๋ ค๊ณ  ํ•˜๋ฉด ์—๋Ÿฌ๋ฅผ ๋ฐœ์ƒ์‹œํ‚จ๋‹ค๋Š” ๊ฒƒ์ด๋‹ค. ๋ณด์•ˆ์— ๊ด€๋ จ๋œ ์ตœ์‹  ๋ฒ„์ „์„ ์ด์šฉํ•˜๋ฉด ํ•ด๋‹น ์—๋Ÿฌ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋‹ค.
๊ทธ๋ž˜์„œ ๋‚ด๊ฐ€ ์„ ํƒํ•œ ํ•ด๋‹น ์—๋Ÿฌ ํ•ด๊ฒฐ๋ฒ•์€ ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•˜๋Š” ๊ฒƒ์ด๋‹ค.

npm audit fix --force

npm audit fix๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋‚ด๊ฐ€ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” ํŒจํ‚ค์ง€์— ๋Œ€ํ•˜์—ฌ, ์ทจ์•ฝ์ ์„ ๊ฐ€์ง„ ์ข…์†์„ฑ์„ ํ˜ธํ™˜๋˜๋Š” ๋ฒ„์ „์œผ๋กœ ์ž๋™์œผ๋กœ ์—…๋ฐ์ดํŠธ๋ฅผ ํ•ด์ฃผ๋Š” ๊ฒƒ์ด๋‹ค. ์‹ค์ œ๋กœ ํ•ด๋‹น ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๋‹ˆ, React-script ์˜ ๋ฒ„์ „์€ 5.0.1 ๋กœ ์—…๋ฐ์ดํŠธ ๋˜๊ณ , ๋ฌธ์ œ ์—†์ด deploy๋ฅผ ์ง„ํ–‰ํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค. ์ด๋กœ ์ธํ•ด ์กด์žฌํ•˜๋˜ ๋ณด์•ˆ ์ด์Šˆ๋“ค์„ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค ๐Ÿ˜†

์˜ค๋Š˜์˜ ๊ฒฐ๋ก .

yarn์„ ์“ฐ์ž!

์ถœ์ฒ˜

Github npm ํŽ˜์ด์ง€
Peer Dependencies์— ๋Œ€ํ•˜์—ฌ

0๊ฐœ์˜ ๋Œ“๊ธ€