gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.22k stars 10.32k forks source link

Can't resolve react in 'react' in 'opt/build/repo/.cache' #29528

Closed samgermain closed 3 years ago

samgermain commented 3 years ago

I get this error output when add gatsby-plugin-preact to my gatsby.config.js and push to netlify even when I do clear cache and deploy site on Netlify. Here's the repo for the project that this error happens with. The project builds and publishes fine if I just remove the line gatsby-plugin-preact from my gatsby.config.js

3:20:22 PM: Build ready to start
3:20:24 PM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
3:20:24 PM: build-image tag: v3.6.1
3:20:24 PM: buildbot version: 3f7ff7bbf92b8c2ecf180659ea5b1472b472d308
3:20:24 PM: Building without cache
3:20:24 PM: Starting to prepare the repo for build
3:20:24 PM: No cached dependencies found. Cloning fresh repo
3:20:24 PM: git clone https://github.com/samgermain/seal-sounds-website
3:20:25 PM: Preparing Git Reference refs/heads/master
3:20:27 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
3:20:27 PM: Starting build script
3:20:27 PM: Installing dependencies
3:20:27 PM: Python version set to 2.7
3:20:29 PM: v12.18.0 is already installed.
3:20:30 PM: Now using node v12.18.0 (npm v6.14.4)
3:20:30 PM: Started restoring cached build plugins
3:20:30 PM: Finished restoring cached build plugins
3:20:31 PM: Attempting ruby version 2.7.1, read from environment
3:20:33 PM: Using ruby version 2.7.1
3:20:33 PM: Using PHP version 5.6
3:20:33 PM: Started restoring cached node modules
3:20:33 PM: Finished restoring cached node modules
3:20:34 PM: Installing NPM modules using NPM version 6.14.4
3:21:39 PM: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
3:21:39 PM: > sharp@0.27.1 install /opt/build/repo/node_modules/sharp
3:21:39 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
3:21:41 PM: info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.5/libvips-8.10.5-linux-x64.tar.br
3:21:43 PM: > node-sass@5.0.0 install /opt/build/repo/node_modules/node-sass
3:21:43 PM: > node scripts/install.js
3:21:44 PM: Downloading binary from https://github.com/sass/node-sass/releases/download/v5.0.0/linux-x64-72_binding.node
3:21:44 PM: Download complete
3:21:44 PM: Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
3:21:44 PM: Caching binary to /opt/buildhome/.npm/node-sass/5.0.0/linux-x64-72_binding.node
3:21:45 PM: > @fortawesome/fontawesome-common-types@0.2.34 postinstall /opt/build/repo/node_modules/@fortawesome/fontawesome-svg-core/node_modules/@fortawesome/fontawesome-common-types
3:21:45 PM: > node attribution.js
3:21:45 PM: Font Awesome Free 0.2.34 by @fontawesome - https://fontawesome.com
3:21:45 PM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
3:21:45 PM: > @fortawesome/fontawesome-common-types@0.2.34 postinstall /opt/build/repo/node_modules/@fortawesome/free-brands-svg-icons/node_modules/@fortawesome/fontawesome-common-types
3:21:45 PM: > node attribution.js
3:21:45 PM: Font Awesome Free 0.2.34 by @fontawesome - https://fontawesome.com
3:21:45 PM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
3:21:45 PM: > core-js@2.6.12 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
3:21:45 PM: > node -e "try{require('./postinstall')}catch(e){}"
3:21:45 PM: > core-js@3.8.3 postinstall /opt/build/repo/node_modules/core-js
3:21:45 PM: > node -e "try{require('./postinstall')}catch(e){}"
3:21:45 PM: > core-js-pure@3.8.3 postinstall /opt/build/repo/node_modules/core-js-pure
3:21:45 PM: > node -e "try{require('./postinstall')}catch(e){}"
3:21:47 PM: > gatsby-telemetry@1.10.0 postinstall /opt/build/repo/node_modules/gatsby-telemetry
3:21:47 PM: > node src/postinstall.js || true
3:21:48 PM: > mozjpeg@7.0.0 postinstall /opt/build/repo/node_modules/mozjpeg
3:21:48 PM: > node lib/install.js
3:21:48 PM:   ✔ mozjpeg pre-build test passed successfully
3:21:48 PM: > pngquant-bin@6.0.0 postinstall /opt/build/repo/node_modules/pngquant-bin
3:21:48 PM: > node lib/install.js
3:21:49 PM:   ✔ pngquant pre-build test passed successfully
3:21:49 PM: > gatsby-cli@2.19.1 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
3:21:49 PM: > node scripts/postinstall.js
3:21:49 PM: > @fortawesome/fontawesome-svg-core@1.2.34 postinstall /opt/build/repo/node_modules/@fortawesome/fontawesome-svg-core
3:21:49 PM: > node attribution.js
3:21:49 PM: Font Awesome Free 1.2.34 by @fontawesome - https://fontawesome.com
3:21:49 PM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
3:21:49 PM: > @fortawesome/free-brands-svg-icons@5.15.2 postinstall /opt/build/repo/node_modules/@fortawesome/free-brands-svg-icons
3:21:49 PM: > node attribution.js
3:21:49 PM: Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
3:21:49 PM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
3:21:49 PM: > gatsby@2.32.3 postinstall /opt/build/repo/node_modules/gatsby
3:21:49 PM: > node scripts/postinstall.js
3:21:49 PM: > node-sass@5.0.0 postinstall /opt/build/repo/node_modules/node-sass
3:21:49 PM: > node scripts/build.js
3:21:50 PM: Binary found at /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
3:21:50 PM: Testing binary
3:21:50 PM: Binary is fine
3:21:53 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
3:21:53 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:21:53 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
3:21:53 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:21:53 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
3:21:53 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:21:53 PM: added 2469 packages from 1447 contributors and audited 2474 packages in 78.675s
3:21:56 PM: 182 packages are looking for funding
3:21:56 PM:   run `npm fund` for details
3:21:56 PM: found 0 vulnerabilities
3:21:57 PM: NPM modules installed
3:21:57 PM: Started restoring cached go cache
3:21:57 PM: Finished restoring cached go cache
3:21:57 PM: go version go1.14.4 linux/amd64
3:21:57 PM: go version go1.14.4 linux/amd64
3:21:57 PM: Installing missing commands
3:21:57 PM: Verify run directory
3:21:59 PM: ​
3:21:59 PM: ────────────────────────────────────────────────────────────────
3:21:59 PM:   Netlify Build                                                 
3:21:59 PM: ────────────────────────────────────────────────────────────────
3:21:59 PM: ​
3:21:59 PM: ❯ Version
3:21:59 PM:   @netlify/build 9.1.2
3:21:59 PM: ​
3:21:59 PM: ❯ Flags
3:21:59 PM:   deployId: 602ae596ea2bd28b34bf47d9
3:21:59 PM:   mode: buildbot
3:21:59 PM: ​
3:21:59 PM: ❯ Current directory
3:21:59 PM:   /opt/build/repo
3:21:59 PM: ​
3:21:59 PM: ❯ Config file
3:21:59 PM:   No config file was defined: using default values.
3:21:59 PM: ​
3:21:59 PM: ❯ Context
3:21:59 PM:   production
3:22:00 PM: ​
3:22:00 PM: ❯ Installing plugins
3:22:00 PM:    - netlify-plugin-submit-sitemap@0.2.3
3:22:00 PM:    - netlify-plugin-gatsby-cache@0.3.0
3:22:00 PM:    - @netlify/plugin-sitemap@0.7.0
3:22:04 PM: ​
3:22:04 PM: ❯ Loading plugins
3:22:04 PM:    - netlify-plugin-submit-sitemap@0.2.3 from Netlify app
3:22:04 PM:    - netlify-plugin-gatsby-cache@0.3.0 from Netlify app
3:22:04 PM:    - @netlify/plugin-sitemap@0.7.0 from Netlify app
3:22:05 PM: ​
3:22:05 PM: ────────────────────────────────────────────────────────────────
3:22:05 PM:   1. onPreBuild command from netlify-plugin-gatsby-cache        
3:22:05 PM: ────────────────────────────────────────────────────────────────
3:22:05 PM: ​
3:22:05 PM: No Gatsby cache found. Building fresh.
3:22:05 PM: ​
3:22:05 PM: (netlify-plugin-gatsby-cache onPreBuild completed in 291ms)
3:22:05 PM: ​
3:22:05 PM: ────────────────────────────────────────────────────────────────
3:22:05 PM:   2. Build command from Netlify app                             
3:22:05 PM: ────────────────────────────────────────────────────────────────
3:22:05 PM: ​
3:22:05 PM: $ gatsby build
3:22:09 PM: success open and validate gatsby-configs - 0.067s
3:22:10 PM: success load plugins - 1.182s
3:22:11 PM: success onPreInit - 0.091s
3:22:11 PM: success delete html and css files from previous builds - 0.005s
3:22:11 PM: success initialize cache - 0.010s
3:22:11 PM: success copy gatsby files - 0.082s
3:22:11 PM: success onPreBootstrap - 0.022s
3:22:11 PM: success createSchemaCustomization - 0.007s
3:22:11 PM: success Checking for changed pages - 0.000s
3:22:11 PM: success source and transform nodes - 0.144s
3:22:11 PM: success building schema - 0.506s
3:22:11 PM: info Total nodes: 42, SitePage nodes: 2 (use --verbose for breakdown)
3:22:11 PM: success createPages - 0.010s
3:22:11 PM: success Checking for changed pages - 0.000s
3:22:12 PM: success createPagesStatefully - 0.109s
3:22:12 PM: success update schema - 0.039s
3:22:12 PM: success onPreExtractQueries - 0.001s
3:22:12 PM: success extract queries from components - 0.714s
3:22:12 PM: success write out redirect data - 0.001s
3:22:14 PM: success Build manifest and related icons - 1.478s
3:22:14 PM: success onPostBootstrap - 1.481s
3:22:14 PM: info bootstrap finished - 8.888s
3:22:17 PM: success run page queries - 3.319s - 6/6 1.81/s
3:22:17 PM: success write out requires - 0.006s
3:22:38 PM: failed Building production JavaScript and CSS bundles - 21.100s
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/.cache'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/.cache'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/.cache'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/.cache'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/.cache'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/.cache'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/.cache'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/.cache/caches/gatsby-plugin-offline'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/node_modules/@fortawesome/react-fontawesome'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/node_modules/@reach/router/es'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/node_modules/gatsby-image'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/node_modules/gatsby-link'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/node_modules/gatsby-react-router-scroll'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/node_modules/gatsby-react-router-scroll'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/node_modules/gatsby-react-router-scroll'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/node_modules/react-helmet/es'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/node_modules/react-side-effect/lib'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/src/components'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/src/components'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/src/pages'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/src/pages'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/src/pages'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react' in '/opt/build/repo/src/pages'
3:22:38 PM: If you're trying to use a package make sure that 'react' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react-dom' in '/opt/build/repo/.cache'
3:22:38 PM: If you're trying to use a package make sure that 'react-dom' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: error Generating JavaScript bundles failed
3:22:38 PM: Can't resolve 'react-dom' in '/opt/build/repo/node_modules/gatsby-react-router-scroll'
3:22:38 PM: If you're trying to use a package make sure that 'react-dom' is installed. If you're trying to use a local file make sure that the path is correct.
3:22:38 PM: not finished Generating image thumbnails - 24.411s
3:22:39 PM: ​
3:22:39 PM: ────────────────────────────────────────────────────────────────
3:22:39 PM:   "build.command" failed                                        
3:22:39 PM: ────────────────────────────────────────────────────────────────
3:22:39 PM: ​
3:22:39 PM:   Error message
3:22:39 PM:   Command failed with exit code 1: gatsby build
3:22:39 PM: ​
3:22:39 PM:   Error location
3:22:39 PM:   In Build command from Netlify app:
3:22:39 PM:   gatsby build
3:22:39 PM: ​
3:22:39 PM:   Resolved config
3:22:39 PM:   build:
3:22:39 PM:     command: gatsby build
3:22:39 PM:     commandOrigin: ui
3:22:39 PM:     publish: /opt/build/repo/public
3:22:39 PM:   plugins:
3:22:39 PM:     - inputs: {}
3:22:39 PM:       origin: ui
3:22:39 PM:       package: netlify-plugin-submit-sitemap
3:22:39 PM:     - inputs: {}
3:22:39 PM:       origin: ui
3:22:39 PM:       package: netlify-plugin-gatsby-cache
3:22:39 PM:     - inputs: {}
3:22:39 PM:       origin: ui
3:22:39 PM:       package: '@netlify/plugin-sitemap'
3:22:39 PM: Caching artifacts
3:22:39 PM: Started saving node modules
3:22:39 PM: Finished saving node modules
3:22:39 PM: Started saving build plugins
3:22:39 PM: Finished saving build plugins
3:22:39 PM: Started saving pip cache
3:22:39 PM: Finished saving pip cache
3:22:39 PM: Started saving emacs cask dependencies
3:22:39 PM: Finished saving emacs cask dependencies
3:22:39 PM: Started saving maven dependencies
3:22:39 PM: Finished saving maven dependencies
3:22:39 PM: Started saving boot dependencies
3:22:39 PM: Finished saving boot dependencies
3:22:39 PM: Started saving rust rustup cache
3:22:39 PM: Finished saving rust rustup cache
3:22:39 PM: Started saving go dependencies
3:22:39 PM: Finished saving go dependencies
3:22:42 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:22:42 PM: Failing build: Failed to build site
3:22:42 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
3:22:42 PM: Finished processing build request in 2m18.709170529s
LekoArts commented 3 years ago

Hi!

You're missing the mandatory packages that are listed here: https://www.gatsbyjs.com/plugins/gatsby-plugin-preact/

preact preact-render-to-string

github-actions[bot] commented 3 years ago

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜