Gatsby: WebpackError: Invariant Violation: ์ถ•์†Œ๋œ React ์˜ค๋ฅ˜ #62

์— ๋งŒ๋“  2019๋…„ 01์›” 26์ผ  ยท  1๋…ผํ‰  ยท  ์ถœ์ฒ˜: gatsbyjs/gatsby

์šฐ๋ฆฌ๊ฐ€ ๋‹น์‹ ์„ ๋” ์‰ฝ๊ฒŒ ๋„์šธ ์ˆ˜ ์žˆ๋„๋ก ๊ฐ€๋Šฅํ•œ ํ•œ ๋งŽ์€ ์œ ์šฉํ•œ ์ •๋ณด๋ฅผ ํฌํ•จํ•˜์‹ญ์‹œ์˜ค. ์œ ์šฉํ•œ ๋งํฌ: - ๋ฌธ์„œ: https://www.gatsbyjs.org/docs/ Gatsby์—๋Š” ์—ฌ๋Ÿฌ ์ปค๋ฎค๋‹ˆํ‹ฐ ์ง€์› ์ฑ„๋„์ด ์žˆ์Šต๋‹ˆ๋‹ค. - Discord: https://gatsby.app/discord - Spectrum: https:// spectrum.chat/gatsby-js - Twitter: https://twitter.com/gatsbyjs ์ƒˆ๋กœ์šด ์ด์Šˆ๋ฅผ ์—ด๊ธฐ ์ „์— ๊ธฐ์กด ์ด์Šˆ๋ฅผ ๊ฒ€์ƒ‰ํ•˜์„ธ์š” https://github.com/gatsbyjs/gatsby/issues

์š”์•ฝ

Gatsby build ๋Š” WebpackError: Invariant Violation: Minified React error #62 ์˜ค๋ฅ˜๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๊ณ , gatsby ๊ฐœ๋ฐœ์€ ํž˜๋“  gatsby develop works fine ์—๋„ ๋ฌธ์ œ ์—†์ด ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

๊ด€๋ จ ์ •๋ณด

error Building static HTML for pages failed

See our docs page on debugging HTML builds for help https://gatsby.app/debug-html

   8 |  else
   9 |          root["lib"] = factory(root["@reach/router"], root["core-js/modules/es6.array.iterator"], root["core-js/modules/es6.array.sort"], root["core-js/modules/es6.function.name"], root["core-js/modules/es6.map"], root["core-js/modules/es6.object.assign"], root["core-js/modules/es6.regexp.constructor"], root["core-js/modules/es6.regexp.split"], root["core-js/modules/es6.regexp.to-string"], root["core-js/modules/es6.string.ends-with"], root["core-js/modules/es6.string.iterator"], root["core-js/modules/web.dom.iterable"], root["fs"], root["lodash"], root["path"], root["react"], root["react-dom/server"], root["react-helmet"]);
> 10 | })(this, function(__WEBPACK_EXTERNAL_MODULE__reach_router__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_array_iterator__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_array_sort__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_function_name__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_map__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_object_assign__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_regexp_constructor__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_regexp_split__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_regexp_to_string__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_string_ends_with__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_string_iterator__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_web_dom_iterable__, __WEBPACK_EXTERNAL_MODULE_fs__, __WEBPACK_EXTERNAL_MODULE_lodash__, __WEBPACK_EXTERNAL_MODULE_path__, __WEBPACK_EXTERNAL_MODULE_react__, __WEBPACK_EXTERNAL_MODULE_react_dom_server__, __WEBPACK_EXTERNAL_MODULE_react_helmet__) {
     |  ^
  11 | return


  WebpackError: Invariant Violation: Minified React error #62; visit https://reactjs.org/docs/error-decoder.html?invariant=62&args[]= for the full message  or use the non-minified dev environment for full errors and additional helpful warnings.

์ด๊ฒƒ์€ ๋‚ด๊ฐ€๋ฐ›๋Š” ์ „์ฒด ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€์ž…๋‹ˆ๋‹ค. ์ „์ฒด React ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€์— ์„ค๋ช…๋œ ๊ฒƒ์ฒ˜๋Ÿผ ์Šคํƒ€์ผ ์†์„ฑ์˜ ์ž˜๋ชป๋œ ๋งคํ•‘์„ ๋ชจ๋‘ ์ œ๊ฑฐํ•˜๋ ค๊ณ  ์‹œ๋„ํ–ˆ์ง€๋งŒ ๋ฌธ์ œ๋Š” ์—ฌ์ „ํžˆ ์ง€์†๋ฉ๋‹ˆ๋‹ค. .cache ๋„ ์‚ญ์ œํ–ˆ์Šต๋‹ˆ๋‹ค.

์ด์ „์— ์„ฑ๊ณต์ ์œผ๋กœ ๋นŒ๋“œํ•  ์ˆ˜ ์žˆ์—ˆ๊ณ  ๋ฉ”์‹œ์ง€๊ฐ€ ๋‚ด ์ฝ”๋“œ์— ๋ฌด์—‡์ด ์ž˜๋ชป๋˜์—ˆ๋Š”์ง€์— ๋Œ€ํ•œ ํ†ต์ฐฐ๋ ฅ์„ ๋” ์ด์ƒ ์ œ๊ณตํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ๋ฌธ์ œ๊ฐ€ ๋  ์ˆ˜ ์žˆ๋Š” ๋‹ค๋ฅธ ๊ฒƒ์ด ๋ฌด์—‡์ธ์ง€ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค. ํŠนํžˆ gatsby develop ์™„๋ฒฝํ•˜๊ฒŒ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

ํ™˜๊ฒฝ(ํ•ด๋‹น๋˜๋Š” ๊ฒฝ์šฐ)

```
์ฒด๊ณ„:
์šด์˜ ์ฒด์ œ: macOS 10.14.2
CPU: (8) x64 Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz
์…ธ: 3.2.57 - /bin/bash
๋ฐ”์ด๋„ˆ๋ฆฌ:
๋…ธ๋“œ: 11.7.0 - /usr/local/bin/node
์›์‚ฌ: 1.13.0 - /usr/local/bin/yarn
npm: 6.5.0 - /usr/local/bin/npm
์–ธ์–ด:
ํŒŒ์ด์ฌ: 2.7.10 - /usr/bin/python
๋ธŒ๋ผ์šฐ์ €:
ํฌ๋กฌ: 71.0.3578.98
์‚ฌํŒŒ๋ฆฌ: 12.0.2
npmํŒจํ‚ค์ง€:
๊ฐœ์ธ ๋น„: ^2.0.76 => 2.0.76
๊ฐœ์ธ ๋น„ ์ด๋ฏธ์ง€: ^2.0.20 => 2.0.25
๊ฐœ์ธ ๋น„ ํ”Œ๋Ÿฌ๊ทธ์ธ ๋งค๋‹ˆํŽ˜์ŠคํŠธ: ^2.0.9 => 2.0.12
๊ฐœ์ธ ๋น„ ํ”Œ๋Ÿฌ๊ทธ์ธ ์˜คํ”„๋ผ์ธ: ^2.0.16 => 2.0.20
๊ฐœ์ธ ๋น„ ํ”Œ๋Ÿฌ๊ทธ์ธ ๋ฐ˜์‘ ํ—ฌ๋ฉง: ^3.0.2 => 3.0.5
๊ฐœ์ธ ๋น„ ํ”Œ๋Ÿฌ๊ทธ์ธ ์ƒคํ”„: ^2.0.14 => 2.0.16
๊ฐœ์ธ ๋น„ ์†Œ์Šค ํŒŒ์ผ ์‹œ์Šคํ…œ: ^2.0.8 => 2.0.12
๊ฐœ์ธ ๋น„ ํŠธ๋žœ์Šคํฌ๋จธ ์ƒคํ”„: ^2.1.8 => 2.1.9

### File contents (if changed)

`gatsby-config.js`:<!-- Please use a code block or just leave it as is if wasn't changed -->

module.exports = {
์‚ฌ์ดํŠธ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ: {
์ œ๋ชฉ: Gatsby Starter ,
์„ค๋ช…: Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need. ,
์ž‘์„ฑ์ž: @gatsbyjs ,
์†Œ์…œ๋งํฌ: [
{
์ด๋ฆ„: Link 1 ,
URL: https://twitter.com/ ,
},
{
์ด๋ฆ„: link 2 ,
URL: https://github.com/ ,
}
],
ํŠน์ง•: [
{
์ œ๋ชฉ: Feature 1 ,
์„ค๋ช…: Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need. ,
},
{
์ œ๋ชฉ: Feature 2 ,
์„ค๋ช…: Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need. ,
},
{
์ œ๋ชฉ: Feature 3 ,
์„ค๋ช…: Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need. ,
},
],
},
ํ”Œ๋Ÿฌ๊ทธ์ธ: [
gatsby-plugin-react-helmet ,
{
ํ•ด๊ฒฐ: gatsby-source-filesystem ,
์˜ต์…˜: {
์ด๋ฆ„: images ,
๊ฒฝ๋กœ: ${__dirname}/src/images ,
},
},
gatsby-transformer-sharp ,
gatsby-plugin-sharp ,
{
ํ•ด๊ฒฐ: gatsby-plugin-manifest ,
์˜ต์…˜: {
์ด๋ฆ„: gatsby-starter-default ,
short_name: starter ,
์‹œ์ž‘ URL: / ,
background_color: #663399 ,
theme_color: #663399 ,
๋””์Šคํ”Œ๋ ˆ์ด: minimal-ui ,
icon: src/images/gatsby-icon.png , // ์ด ๊ฒฝ๋กœ๋Š” ์‚ฌ์ดํŠธ์˜ ๋ฃจํŠธ์— ์ƒ๋Œ€์ ์ž…๋‹ˆ๋‹ค.
},
},
// ์ด (์„ ํƒ ์‚ฌํ•ญ) ํ”Œ๋Ÿฌ๊ทธ์ธ์€ ํ”„๋กœ๊ทธ๋ ˆ์‹œ๋ธŒ ์›น ์•ฑ + ์˜คํ”„๋ผ์ธ ๊ธฐ๋Šฅ์„ ํ™œ์„ฑํ™”ํ•ฉ๋‹ˆ๋‹ค.
// ์ž์„ธํžˆ ์•Œ์•„๋ณด๋ ค๋ฉด https://gatsby.app/offline์„ ๋ฐฉ๋ฌธ
// '๊ฐœ์ธ ๋น„ ํ”Œ๋Ÿฌ๊ทธ์ธ ์˜คํ”„๋ผ์ธ',
],
}

`package.json`:<!-- Please use a code block or just leave it as is if wasn't changed -->

{
"์ด๋ฆ„": "gatsby-starter-default",
"๋น„๊ณต๊ฐœ": ์‚ฌ์‹ค,
"description": "Gatsby์™€ ํ•จ๊ป˜ ๋น ๋ฅด๊ฒŒ ์‹œ์ž‘ํ•˜๊ณ  ๊ฐœ๋ฐœํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ„๋‹จํ•œ ์Šคํƒ€ํ„ฐ",
"๋ฒ„์ „": "0.1.0",
"์ €์ž": "Kyle Mathews [email protected] ",
"์ข…์†์„ฑ": {
"๊ฐœ์ธ ๋น„": "^2.0.76",
"๊ฐœ์ธ ๋น„ ์ด๋ฏธ์ง€": "^2.0.20",
"gatsby-plugin-manifest": "^2.0.9",
"gatsby-plugin-offline": "^2.0.16",
"gatsby-plugin-react-helmet": "^3.0.2",
"gatsby-plugin-sharp": "^2.0.14",
"๊ฐœ์ธ ๋น„ ์†Œ์Šค ํŒŒ์ผ ์‹œ์Šคํ…œ": "^2.0.8",
"๊ฐœ์ธ ๋น„ ํŠธ๋žœ์Šคํฌ๋จธ ์ƒคํ”„": "^2.1.8",
"์†Œํ’ˆ ์œ ํ˜•": "^15.6.2",
"๋ฐ˜์‘": "^16.6.3",
"react-dom": "^16.6.3",
"๋ฐ˜์‘ ํ—ฌ๋ฉง": "^5.2.0"
},
"ํ‚ค์›Œ๋“œ": [
"๊ฐœ์ธ ๋น„"
],
"๋ผ์ด์„ผ์Šค": "MIT",
"์Šคํฌ๋ฆฝํŠธ": {
"๋นŒ๋“œ": "๊ฐœ์ธ ๋น„ ๋นŒ๋“œ",
"๊ฐœ๋ฐœํ•˜๋‹ค": "๊ฐœ์ธ ๋น„ ๊ฐœ๋ฐœํ•˜๋‹ค",
"์‹œ์ž‘": "npm ์‹คํ–‰ ๊ฐœ๋ฐœ",
"ํ˜•์‹": "๋” ์˜ˆ์œ --write \"src/ */ .js\"",
"test": "์—์ฝ” \"ํ…Œ์ŠคํŠธ๋ฅผ ์ž‘์„ฑํ•˜์‹ญ์‹œ์˜ค! -> https://gatsby.app/unit-testing\ ""
},
"devDependencies": {
"๋” ์˜ˆ์˜๋‹ค": "^1.15.2"
},
"์ €์žฅ์†Œ": {
"์œ ํ˜•": "git",
"url": " https://github.com/gatsbyjs/gatsby-starter-default "
},
"๋ฒ„๊ทธ": {
"url": " https://github.com/gatsbyjs/gatsby/issues "
}
}
`` gatsby-node.js : N/A <!-- Please use a code block or just leave it as is if wasn't changed --> gatsby-browser.js : N/A <!-- Please use a code block or just leave it as is if wasn't changed --> gatsby-ssr.js`: N/A

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

~ @AlexanderProd ๋™์ผํ•œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹น์‹ ์˜ ์›์ธ์€ ๋ฌด์—‡์ด์—ˆ์Šต๋‹ˆ๊นŒ?

์‹ ๊ฒฝ์“ฐ์ง€ ๋งˆ์„ธ์š”, ์ œ ๊ฒฝ์šฐ์—๋Š”

bodyAttributes={{
  style: 'some style string'
}}

์ž๋™ ์ƒ์„ฑ๋œ SEO.js ์˜ <Helmet /> ์ธ์Šคํ„ด์Šค ๋‚ด๋ถ€. ์Šคํƒ€์ผ ๊ฐœ์ฒด๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋ฐ˜์‘ ํ—ฌ๋ฉง์˜ ๋ฌธ์ œ๋ผ๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ๋‚ด ์Šคํƒ€์ผ์„ ํด๋ž˜์Šค๋กœ ๋ณ€ํ™˜ํ•˜๊ณ  ๋Œ€์‹  ์‚ฌ์šฉํ•˜๋ฉด ๋‚ด ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

Google์„ ํ†ตํ•ด ๋„์ฐฉํ•œ ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž์˜ ๊ฒฝ์šฐ ์˜ค๋ฅ˜๋Š” ์ž˜๋ชป๋œ style ํ˜ธ์ถœ์ž…๋‹ˆ๋‹ค(์ฆ‰, ๋ฌธ์ž์—ด์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  ๊ฐœ์ฒด๋ฅผ ์‚ฌ์šฉ).

>๋ชจ๋“  ๋Œ“๊ธ€

~ @AlexanderProd ๋™์ผํ•œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹น์‹ ์˜ ์›์ธ์€ ๋ฌด์—‡์ด์—ˆ์Šต๋‹ˆ๊นŒ?

์‹ ๊ฒฝ์“ฐ์ง€ ๋งˆ์„ธ์š”, ์ œ ๊ฒฝ์šฐ์—๋Š”

bodyAttributes={{
  style: 'some style string'
}}

์ž๋™ ์ƒ์„ฑ๋œ SEO.js ์˜ <Helmet /> ์ธ์Šคํ„ด์Šค ๋‚ด๋ถ€. ์Šคํƒ€์ผ ๊ฐœ์ฒด๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋ฐ˜์‘ ํ—ฌ๋ฉง์˜ ๋ฌธ์ œ๋ผ๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ๋‚ด ์Šคํƒ€์ผ์„ ํด๋ž˜์Šค๋กœ ๋ณ€ํ™˜ํ•˜๊ณ  ๋Œ€์‹  ์‚ฌ์šฉํ•˜๋ฉด ๋‚ด ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

Google์„ ํ†ตํ•ด ๋„์ฐฉํ•œ ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž์˜ ๊ฒฝ์šฐ ์˜ค๋ฅ˜๋Š” ์ž˜๋ชป๋œ style ํ˜ธ์ถœ์ž…๋‹ˆ๋‹ค(์ฆ‰, ๋ฌธ์ž์—ด์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  ๊ฐœ์ฒด๋ฅผ ์‚ฌ์šฉ).

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰

๊ด€๋ จ ๋ฌธ์ œ

hobochild picture hobochild  ยท  3์ฝ”๋ฉ˜ํŠธ

totsteps picture totsteps  ยท  3์ฝ”๋ฉ˜ํŠธ

jimfilippou picture jimfilippou  ยท  3์ฝ”๋ฉ˜ํŠธ

magicly picture magicly  ยท  3์ฝ”๋ฉ˜ํŠธ

andykais picture andykais  ยท  3์ฝ”๋ฉ˜ํŠธ