pixie-io / docs.px.dev

Pixie Documentation
https://docs.px.dev
Apache License 2.0
16 stars 22 forks source link

Upgrade gatsby to fix locally development issues #264

Open ddelnano opened 1 year ago

ddelnano commented 1 year ago

Describe the bug While working on #263, I tried to following the steps for local development (yarn install && yarn start). When doing so, I run into the following error:

yarn start error ```bash ddelnano@vigenere:~/code/docs.px.dev (main) $ yarn start yarn run v1.22.4 $ gatsby develop ╔════════════════════════════════════════════════════════════════════════╗ ║ ║ ║ Gatsby collects anonymous usage analytics ║ ║ to help improve Gatsby for all users. ║ ║ ║ ║ If you'd like to opt-out, you can use `gatsby telemetry --disable` ║ ║ To learn more, checkout https://gatsby.dev/telemetry ║ ║ ║ ╚════════════════════════════════════════════════════════════════════════╝ success open and validate gatsby-configs - 0.202s ERROR #11329 Your plugins must export known APIs from their gatsby-node.js. See https://www.gatsbyjs.org/docs/node-apis/ for the list of Gatsby node APIs. - The plugin gatsby-plugin-sass@2.8.0 is using the API "pluginOptionsSchema" which was introduced in gatsby@2.25.0. Some of the following may help fix the error(s): - npm install gatsby@^2.25.0 success load plugins - 0.764s success onPreInit - 0.007s success initialize cache - 0.006s success copy gatsby files - 0.019s success onPreBootstrap - 0.011s success createSchemaCustomization - 0.004s warn Browserslist: caniuse-lite is outdated. Please run: npx browserslist@latest --update-db success source and transform nodes - 7.478s success building schema - 0.220s success create redirects success createPages - 5.227s success createPagesStatefully - 0.078s success onPreExtractQueries - 0.002s success update schema - 0.054s success extract queries from components - 0.296s success write out requires - 0.056s success write out redirect data - 0.010s success onPostBootstrap - 0.014s ⠀ info bootstrap finished - 16.080s ⠀ success run static queries - 0.084s - 4/4 47.41/s success run page queries - 0.703s - 328/328 466.50/s ERROR error:0308010C:digital envelope routines::unsupported Error: error:0308010C:digital envelope routines::unsupported - hash:71 new Hash node:internal/crypto/hash:71:19 - node:crypto:133 Object.createHash node:crypto:133:10 - createHash.js:135 module.exports [docs.px.dev]/[webpack]/lib/util/createHash.js:135:53 - NormalModule.js:417 NormalModule._initBuildHash [docs.px.dev]/[webpack]/lib/NormalModule.js:417:16 - NormalModule.js:452 [docs.px.dev]/[webpack]/lib/NormalModule.js:452:10 - NormalModule.js:323 [docs.px.dev]/[webpack]/lib/NormalModule.js:323:13 - LoaderRunner.js:367 [docs.px.dev]/[loader-runner]/lib/LoaderRunner.js:367:11 - LoaderRunner.js:233 [docs.px.dev]/[loader-runner]/lib/LoaderRunner.js:233:18 - LoaderRunner.js:111 context.callback [docs.px.dev]/[loader-runner]/lib/LoaderRunner.js:111:13 - index.js:59 [docs.px.dev]/[babel-loader]/lib/index.js:59:103 error Command failed with exit code 1. ```

To Reproduce Steps to reproduce the behavior:

  1. Clone the repo
  2. Run yarn install && yarn start

Expected behavior

Screenshots

N/A

Additional context

It appears this is an issue with webpack. https://github.com/webpack/webpack/issues/14532 describes how webpack 4 was broken by a OpenSSL nodejs change and that they did not intend to backport any fixes. So I believe the solution is to upgrade webpack.

We don't depend on webpack directly, but gatsy is pulling it in as seen in the yarn why output below.

$ yarn why webpack
yarn why v1.22.4
[1/4] Why do we have the module "webpack"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "webpack@4.43.0"
info Reasons this module exists
   - "gatsby" depends on it
   - Hoisted from "gatsby#webpack"
info Disk size without dependencies: "2.51MB"
info Disk size with unique dependencies: "9.92MB"
info Disk size with transitive dependencies: "27.18MB"
info Number of shared dependencies: 115
Done in 0.84s.

Environment

$ yarn run gatsby info --clipboard
yarn run v1.22.4
$ /home/ddelnano/code/docs.px.dev/node_modules/.bin/gatsby info --clipboard

  System:
    OS: Linux 5.19 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
    CPU: (96) x64 Intel(R) Xeon(R) CPU @ 2.60GHz
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.16.0 - /tmp/yarn--1686257644527-0.02912015325340378/node
    Yarn: 1.22.4 - /tmp/yarn--1686257644527-0.02912015325340378/yarn
    npm: 9.5.1 - /opt/px_dev/tools/node/bin/npm
  Languages:
    Python: 3.10.6 - /usr/bin/python
  Browsers:
    Chrome: 113.0.5672.92
    Firefox: 114.0
  npmPackages:
    gatsby: 2.23.3 => 2.23.3
    gatsby-link: ^2.4.6 => 2.4.6
    gatsby-plugin-algolia: ^0.11.2 => 0.11.2
    gatsby-plugin-emotion: 4.3.4 => 4.3.4
    gatsby-plugin-force-trailing-slashes: 1.0.4 => 1.0.4
    gatsby-plugin-google-fonts: ^1.0.1 => 1.0.1
    gatsby-plugin-gtag: ^1.0.10 => 1.0.13
    gatsby-plugin-layout: ^1.0.15 => 1.3.4
    gatsby-plugin-material-ui: ^2.1.9 => 2.1.9
    gatsby-plugin-mdx: ^1.0.44 => 1.2.15
    gatsby-plugin-meta-redirect: ^1.1.1 => 1.1.1
    gatsby-plugin-react-css-modules-scss-support: ^0.1.0 => 0.1.0
    gatsby-plugin-react-helmet: ^3.0.12 => 3.3.10
    gatsby-plugin-react-helmet-canonical-urls: ^1.4.0 => 1.4.0
    gatsby-plugin-remove-serviceworker: ^1.0.0 => 1.0.0
    gatsby-plugin-sass: ^2.1.27 => 2.8.0
    gatsby-plugin-segment-js: ^3.1.0 => 3.3.0
    gatsby-plugin-sharp: ^2.6.11 => 2.6.11
    gatsby-plugin-sitemap: ^2.0.12 => 2.4.5
    gatsby-plugin-styled-components: ^3.3.10 => 3.3.10
    gatsby-plugin-typescript: ^2.3.1 => 2.4.6
    gatsby-redirect-from: ^0.2.4 => 0.2.4
    gatsby-remark-copy-linked-files: ^2.0.11 => 2.3.5
    gatsby-remark-images: 3.0.10 => 3.0.10
    gatsby-remark-relative-images: ^0.2.3 => 0.2.3
    gatsby-source-filesystem: ^2.0.29 => 2.3.11
    gatsby-theme-material-ui: ^1.0.10 => 1.0.10
    gatsby-transformer-remark: ^2.3.8 => 2.8.15

Done in 2.47s.

Until this issue is fixed, it can be worked around by setting export NODE_OPTIONS=--openssl-legacy-provider prior to running yarn.

ddelnano commented 1 year ago

After talking with @NickLanam, I learned that the site is built with Node v14. That is prior to the v17 issues where the breaking openssl change occurred.