Gatsby: _styledComponents.ServerStyleSheetはコンストラクターエラーではありません

作成日 2017年12月14日  ·  3コメント  ·  ソース: gatsbyjs/gatsby

説明

githubページでyarndeployを実行すると、このWebpackエラーが発生します。

"deploy": "gatsby build --prefix-paths && gh-pages -d public",

error Building static HTML for pages failed`

`See our docs page on debugging HTML builds for help https://goo.gl/yL9lND`

  `16 |       setHeadComponents = _ref.setHeadComponents;
  17 |
> 18 |   var sheet = new _styledComponents.ServerStyleSheet();
     | ^
  19 |
  20 |   var app = _react2.default.createElement(
  21 |     _styledComponents.StyleSheetManager,`


`WebpackError: _styledComponents.ServerStyleSheet is not a constructor`

  - gatsby-ssr.js:18 Object.exports.replaceRenderer
    ~/gatsby-plugin-styled-components/gatsby-ssr.js:18:1

  - api-runner-ssr.js:23
    .cache/api-runner-ssr.js:23:41


  - api-runner-ssr.js:21 module.exports
    .cache/api-runner-ssr.js:21:25

  - static-entry.js:113 module.exports
    .cache/static-entry.js:113:3

  - static-entry.js:99 Function.Promise.fromNode.Promise.fromCallback
    .cache/static-entry.js:99:20





error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

gatsby-plugin-styled-components: "2.0.2"styled-components: "2.2.4"ます。

gatsby-pluging-styled-componentsはSSRを正しく処理する必要がありましたか? または、手動で構成する必要がありますか? 数か月前にgithubページの最初のバージョンをデプロイしたときに正常に機能しました。

最も参考になるコメント

グーグルからここに来る人のために....
@ material-ui / core / stylesが実際にServerStyleSheetsをエクスポートすることを確認してください

これにより、私は古いマテリアルを実行していることに気付きました-ui / core(3.9.x)
4.5.1にアップグレードすることで修正されました

全てのコメント3件

問題はクローズできます。 スタイル付きコンポーネントのピア依存関係をインストールしなかったため、そのことに気づきました。

@jaanhioどのようにしてこれを解決したのか説明できますか? 私も同じ種類のエラーが発生しています。

TypeError: _material_ui_core_styles__WEBPACK_IMPORTED_MODULE_10__.ServerStyleSheets is not a constructor
    at eval (webpack:///./server/helpers/renderer.js?:37:16)
    at eval (webpack:///./server/index.js?:54:81)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

グーグルからここに来る人のために....
@ material-ui / core / stylesが実際にServerStyleSheetsをエクスポートすることを確認してください

これにより、私は古いマテリアルを実行していることに気付きました-ui / core(3.9.x)
4.5.1にアップグレードすることで修正されました

このページは役に立ちましたか?
0 / 5 - 0 評価

関連する問題

kalinchernev picture kalinchernev  ·  3コメント

totsteps picture totsteps  ·  3コメント

KyleAMathews picture KyleAMathews  ·  3コメント

jimfilippou picture jimfilippou  ·  3コメント

ferMartz picture ferMartz  ·  3コメント