Hello,
My app is working fine locally but failing to deploy. The log is below. Any debugging advice would be much appreciated.
9:59:44 AM: build-image version: 9cade8af58c2cf3a17a1e9433d2e979149488837
9:59:44 AM: build-image tag: v3.3.5
9:59:44 AM: buildbot version: 6fd888c8d66fd09bb18f09e1728e11fbc555b868
9:59:45 AM: Fetching cached dependencies
9:59:45 AM: Starting to download cache of 149.1MB
9:59:46 AM: Finished downloading cache in 1.374842805s
9:59:46 AM: Starting to extract cache
9:59:51 AM: Finished extracting cache in 5.189880473s
9:59:51 AM: Finished fetching cache in 6.654175385s
9:59:51 AM: Starting to prepare the repo for build
9:59:52 AM: Preparing Git Reference refs/heads/master
9:59:53 AM: Found Netlify configuration file netlify.toml in site root
9:59:53 AM: Found Netlify configuration file(s). Overriding site configuration
9:59:53 AM: Starting build script
9:59:53 AM: Installing dependencies
9:59:53 AM: Started restoring cached node version
9:59:56 AM: Finished restoring cached node version
9:59:57 AM: v10.19.0 is already installed.
9:59:58 AM: Now using node v10.19.0 (npm v6.13.4)
9:59:58 AM: Attempting ruby version 2.6.2, read from environment
10:00:00 AM: Using ruby version 2.6.2
10:00:01 AM: Using PHP version 5.6
10:00:01 AM: Started restoring cached node modules
10:00:01 AM: Finished restoring cached node modules
10:00:01 AM: Started restoring cached yarn cache
10:00:01 AM: Finished restoring cached yarn cache
10:00:02 AM: Installing NPM modules using Yarn version 1.9.4
10:00:02 AM: yarn install v1.9.4
10:00:03 AM: [1/4] Resolving packages...
10:00:04 AM: [2/4] Fetching packages...
10:00:04 AM: (node:1207) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
10:00:20 AM: info fsevents@1.2.11: The platform "linux" is incompatible with this module.
10:00:20 AM: info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
10:00:20 AM: [3/4] Linking dependencies...
10:00:20 AM: warning " > markdown-to-jsx@6.10.3" has unmet peer dependency "react@>= 0.14.0".
10:00:20 AM: warning " > opentok-react@0.9.0" has unmet peer dependency "react@^15.5.0 || ^16.0.0".
10:00:20 AM: warning "eslint-config-synacor > eslint-plugin-react > eslint-plugin-eslint-plugin@2.1.0" has incorrect peer dependency "eslint@>=5.0.0".
10:00:20 AM: warning " > jest-preset-preact@1.0.0" has incorrect peer dependency "jest@24.x".
10:00:20 AM: warning "preact-cli > @preact/async-loader@3.0.0-rc.0" has incorrect peer dependency "preact@^8.1.0".
10:00:20 AM: warning "preact-cli > react-hot-loader@4.12.18" has unmet peer dependency "@types/react@^15.0.0 || ^16.0.0".
10:00:20 AM: warning "preact-cli > react-hot-loader@4.12.18" has unmet peer dependency "react@^15.0.0 || ^16.0.0".
10:00:20 AM: warning "preact-cli > react-hot-loader@4.12.18" has unmet peer dependency "react-dom@^15.0.0 || ^16.0.0".
10:00:20 AM: warning " > preact-render-spy@1.3.0" has incorrect peer dependency "preact@^8.1.0".
10:00:27 AM: [4/4] Building fresh packages...
10:00:29 AM: success Saved lockfile.
10:00:29 AM: Done in 26.87s.
10:00:29 AM: NPM modules installed using Yarn
10:00:30 AM: Started restoring cached go cache
10:00:30 AM: Finished restoring cached go cache
10:00:30 AM: unset GOOS;
10:00:30 AM: unset GOARCH;
10:00:30 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
10:00:30 AM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
10:00:30 AM: go version >&2;
10:00:30 AM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
10:00:30 AM: go version go1.12 linux/amd64
10:00:30 AM: Installing missing commands
10:00:30 AM: Verify run directory
10:00:30 AM: Executing user command: yarn build
10:00:30 AM: yarn run v1.9.4
10:00:30 AM: $ preact build --prerenderUrls ./prerender-urls.js
10:00:33 AM: ℹ INFO Fetching URLs from ./prerender-urls.js
10:00:33 AM: ℹ INFO Fetched URLs from ./prerender-urls.js
10:00:41 AM: [BABEL] Note: The code generator has deoptimised the styling of /opt/build/repo/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
10:00:49 AM: ssr-bundle.8dbb9.css ⏤ 2.24 kB (+2.24 kB)
10:00:49 AM: ssr-bundle.js ⏤ 73 kB (+73 kB)
10:00:49 AM: ℹ INFO ⚛️ No custom sw.js detected: compiling default Service Worker.
10:00:54 AM: [BABEL] Note: The code generator has deoptimised the styling of /opt/build/repo/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
10:00:58 AM: [BABEL] Note: The code generator has deoptimised the styling of /opt/build/repo/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
10:01:15 AM: [BABEL] Note: The code generator has deoptimised the styling of /opt/build/repo/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
10:01:32 AM: sw-esm.js ⏤ 747 B (+747 B)
10:01:32 AM: sw.js ⏤ 744 B (+744 B)
10:01:32 AM: bundle.d557c.css ⏤ 896 B (+896 B)
10:01:32 AM: bundle.fade5.esm.js ⏤ 9.21 kB (+9.21 kB)
10:01:32 AM: polyfills.635c7.esm.js ⏤ 2.02 kB (+2.02 kB)
10:01:32 AM: route-blog.chunk.cefb8.css ⏤ 376 B (+376 B)
10:01:32 AM: route-blog.chunk.99df4.esm.js ⏤ 8.69 kB (+8.69 kB)
10:01:32 AM: route-blogs.chunk.47f62.css ⏤ 508 B (+508 B)
10:01:32 AM: route-blogs.chunk.e3565.esm.js ⏤ 629 B (+629 B)
10:01:32 AM: route-contact.chunk.c3bc0.css ⏤ 386 B (+386 B)
10:01:32 AM: route-contact.chunk.d0f1c.esm.js ⏤ 62 kB (+62 kB)
10:01:32 AM: route-contact-success.chunk.28115.css ⏤ 182 B (+182 B)
10:01:32 AM: route-contact-success.chunk.279b8.esm.js ⏤ 311 B (+311 B)
10:01:32 AM: route-home.chunk.33ca1.css ⏤ 546 B (+546 B)
10:01:32 AM: route-home.chunk.7a554.esm.js ⏤ 661 B (+661 B)
10:01:32 AM: bundle.ec295.js ⏤ 9.27 kB (+9.27 kB)
10:01:32 AM: polyfills.d4c1e.js ⏤ 2.01 kB (+2.01 kB)
10:01:32 AM: route-blog.chunk.b6d5d.js ⏤ 8.68 kB (+8.68 kB)
10:01:32 AM: route-blogs.chunk.21df4.js ⏤ 632 B (+632 B)
10:01:32 AM: route-contact.chunk.8860e.js ⏤ 62 kB (+62 kB)
10:01:32 AM: route-contact-success.chunk.50d8b.js ⏤ 315 B (+315 B)
10:01:32 AM: route-home.chunk.62bc0.js ⏤ 658 B (+658 B)
10:01:32 AM: Unable to read file: /opt/build/repo/src/node_modules/scriptjs/dist/script.js
10:01:32 AM:
10:01:32 AM: ReferenceError: document is not defined
10:01:32 AM: method: null
10:01:32 AM: at: /opt/build/repo/src/node_modules/scriptjs/dist/script.js:12:12
10:01:32 AM: Source code:
10:01:32 AM: This is most likely caused by using DOM or Web APIs.
10:01:32 AM: Pre-render runs in node and has no access to globals available in browsers.
10:01:32 AM: Consider wrapping code producing error in: 'if (typeof window !== "undefined") { ... }'
10:01:32 AM: Alternatively use 'preact build --no-prerender' to disable prerendering.
10:01:32 AM: See https://github.com/developit/preact-cli#pre-rendering for further information.
10:01:33 AM: error Command failed with exit code 1.
10:01:33 AM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
10:01:33 AM: Skipping functions preparation step: no functions directory set
10:01:33 AM: Caching artifacts
10:01:33 AM: Started saving node modules
10:01:33 AM: Finished saving node modules
10:01:33 AM: Started saving yarn cache
10:01:33 AM: Finished saving yarn cache
10:01:33 AM: Started saving pip cache
10:01:33 AM: Finished saving pip cache
10:01:33 AM: Started saving emacs cask dependencies
10:01:33 AM: Finished saving emacs cask dependencies
10:01:33 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
10:01:33 AM: Started saving maven dependencies
10:01:33 AM: Finished saving maven dependencies
10:01:33 AM: Started saving boot dependencies
10:01:33 AM: Finished saving boot dependencies
10:01:33 AM: Shutting down logging, 5 messages pending```