Failing to deploy using Astro and Netlify

Hope all well.

First time trying to deploy and coming up with an issue, tiny-cucurucho-ad89c9:

Deploy log below, can you help?

4:16:03 PM: Build ready to start
4:16:29 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
4:16:29 PM: build-image tag: v4.10.1
4:16:29 PM: buildbot version: 37262c48b1f3cfa88c6caed707d29b19aef6a5a7
4:16:29 PM: Building without cache
4:16:29 PM: Starting to prepare the repo for build
4:16:29 PM: No cached dependencies found. Cloning fresh repo
4:16:29 PM: git clone https://github.com/studiohic/vanderbilt
4:16:30 PM: Preparing Git Reference refs/heads/master
4:16:30 PM: Parsing package.json dependencies
4:16:31 PM: Starting build script
4:16:31 PM: Installing dependencies
4:16:31 PM: Python version set to 2.7
4:16:32 PM: Downloading and installing node v16.17.0...
4:16:32 PM: Downloading https://nodejs.org/dist/v16.17.0/node-v16.17.0-linux-x64.tar.xz...
4:16:32 PM: Computing checksum with sha256sum
4:16:32 PM: Checksums matched!
4:16:36 PM: Now using node v16.17.0 (npm v8.15.0)
4:16:36 PM: Started restoring cached build plugins
4:16:36 PM: Finished restoring cached build plugins
4:16:36 PM: Attempting ruby version 2.7.2, read from environment
4:16:36 PM: Using ruby version 2.7.2
4:16:37 PM: Using PHP version 8.0
4:16:37 PM: Started restoring cached yarn cache
4:16:37 PM: Finished restoring cached yarn cache
4:16:37 PM: No yarn workspaces detected
4:16:37 PM: Started restoring cached node modules
4:16:37 PM: Finished restoring cached node modules
4:16:37 PM: Installing NPM modules using Yarn version 1.22.10
4:16:37 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
4:16:37 PM: npm WARN config location in the cache, and they are managed by
4:16:37 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
4:16:37 PM: yarn install v1.22.10
4:16:38 PM: [1/4] Resolving packages...
4:16:38 PM: [2/4] Fetching packages...
4:16:48 PM: info @esbuild/linux-loong64@0.14.54: The CPU architecture "x64" is incompatible with this module.
4:16:48 PM: info "@esbuild/linux-loong64@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-android-64@0.14.54: The platform "linux" is incompatible with this module.
4:16:48 PM: info "esbuild-android-64@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-android-arm64@0.14.54: The platform "linux" is incompatible with this module.
4:16:48 PM: info "esbuild-android-arm64@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-android-arm64@0.14.54: The CPU architecture "x64" is incompatible with this module.
4:16:48 PM: info esbuild-darwin-64@0.14.54: The platform "linux" is incompatible with this module.
4:16:48 PM: info "esbuild-darwin-64@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-darwin-arm64@0.14.54: The platform "linux" is incompatible with this module.
4:16:48 PM: info "esbuild-darwin-arm64@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-darwin-arm64@0.14.54: The CPU architecture "x64" is incompatible with this module.
4:16:48 PM: info esbuild-freebsd-64@0.14.54: The platform "linux" is incompatible with this module.
4:16:48 PM: info "esbuild-freebsd-64@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-freebsd-arm64@0.14.54: The platform "linux" is incompatible with this module.
4:16:48 PM: info "esbuild-freebsd-arm64@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-freebsd-arm64@0.14.54: The CPU architecture "x64" is incompatible with this module.
4:16:48 PM: info esbuild-linux-32@0.14.54: The CPU architecture "x64" is incompatible with this module.
4:16:48 PM: info "esbuild-linux-32@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-linux-arm@0.14.54: The CPU architecture "x64" is incompatible with this module.
4:16:48 PM: info "esbuild-linux-arm@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-linux-arm64@0.14.54: The CPU architecture "x64" is incompatible with this module.
4:16:48 PM: info "esbuild-linux-arm64@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-linux-mips64le@0.14.54: The CPU architecture "x64" is incompatible with this module.
4:16:48 PM: info "esbuild-linux-mips64le@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-linux-ppc64le@0.14.54: The CPU architecture "x64" is incompatible with this module.
4:16:48 PM: info "esbuild-linux-ppc64le@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-linux-riscv64@0.14.54: The CPU architecture "x64" is incompatible with this module.
4:16:48 PM: info "esbuild-linux-riscv64@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-linux-s390x@0.14.54: The CPU architecture "x64" is incompatible with this module.
4:16:48 PM: info "esbuild-linux-s390x@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-netbsd-64@0.14.54: The platform "linux" is incompatible with this module.
4:16:48 PM: info "esbuild-netbsd-64@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-openbsd-64@0.14.54: The platform "linux" is incompatible with this module.
4:16:48 PM: info "esbuild-openbsd-64@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-sunos-64@0.14.54: The platform "linux" is incompatible with this module.
4:16:48 PM: info "esbuild-sunos-64@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-windows-32@0.14.54: The platform "linux" is incompatible with this module.
4:16:48 PM: info "esbuild-windows-32@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-windows-32@0.14.54: The CPU architecture "x64" is incompatible with this module.
4:16:48 PM: info esbuild-windows-64@0.14.54: The platform "linux" is incompatible with this module.
4:16:48 PM: info "esbuild-windows-64@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-windows-arm64@0.14.54: The platform "linux" is incompatible with this module.
4:16:48 PM: info "esbuild-windows-arm64@0.14.54" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: info esbuild-windows-arm64@0.14.54: The CPU architecture "x64" is incompatible with this module.
4:16:48 PM: info fsevents@2.3.2: The platform "linux" is incompatible with this module.
4:16:48 PM: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
4:16:48 PM: [3/4] Linking dependencies...
4:16:48 PM: warning "@astrojs/svelte > @sveltejs/vite-plugin-svelte@1.0.5" has incorrect peer dependency "vite@^3.0.0".
4:16:48 PM: warning "@astrojs/svelte > svelte2tsx@0.5.16" has unmet peer dependency "typescript@^4.1.2".
4:16:48 PM: warning " > autoprefixer@10.4.8" has unmet peer dependency "postcss@^8.1.0".
4:16:48 PM: warning " > tailwindcss@3.1.8" has unmet peer dependency "postcss@^8.0.9".
4:16:51 PM: [4/4] Building fresh packages...
4:16:52 PM: Done in 14.98s.
4:16:52 PM: NPM modules installed using Yarn
4:16:53 PM: Started restoring cached go cache
4:16:53 PM: Finished restoring cached go cache
4:16:53 PM: Installing Go version 1.17 (requested 1.17)
4:16:57 PM: unset GOOS;
4:16:57 PM: unset GOARCH;
4:16:57 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
4:16:57 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
4:16:57 PM: go version >&2;
4:16:57 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
4:16:57 PM: go version go1.17 linux/amd64
4:16:57 PM: Installing missing commands
4:16:57 PM: Verify run directory
4:16:58 PM: ​
4:16:58 PM: ────────────────────────────────────────────────────────────────
4:16:58 PM:   Netlify Build                                                 
4:16:58 PM: ────────────────────────────────────────────────────────────────
4:16:58 PM: ​
4:16:58 PM: ❯ Version
4:16:58 PM:   @netlify/build 27.17.1
4:16:58 PM: ​
4:16:58 PM: ❯ Flags
4:16:58 PM:   baseRelDir: true
4:16:58 PM:   buildId: 6318b5b3c15f321db82248eb
4:16:58 PM:   deployId: 6318b5b3c15f321db82248ed
4:16:58 PM: ​
4:16:58 PM: ❯ Current directory
4:16:58 PM:   /opt/build/repo
4:16:58 PM: ​
4:16:58 PM: ❯ Config file
4:16:58 PM:   /opt/build/repo/netlify.toml
4:16:58 PM: ​
4:16:58 PM: ❯ Context
4:16:58 PM:   production
4:16:58 PM: ​
4:16:58 PM: ────────────────────────────────────────────────────────────────
4:16:58 PM:   1. build.command from netlify.toml                            
4:16:58 PM: ────────────────────────────────────────────────────────────────
4:16:58 PM: ​
4:16:58 PM: $ astro build
4:17:00 PM: 03:17:00 PM [build] output target: server
4:17:00 PM: 03:17:00 PM [build] deploy adapter: @astrojs/netlify/functions
4:17:00 PM: 03:17:00 PM [build] Collecting build info...
4:17:00 PM: 03:17:00 PM [build] Completed in 20ms.
4:17:00 PM: 03:17:00 PM [build] Building server entrypoints...
4:17:02 PM: 03:17:02 PM [build] Completed in 2.07s.
4:17:02 PM: 
4:17:02 PM:  building client 
4:17:03 PM: Completed in 0.97s.
4:17:03 PM: 
4:17:03 PM: 
4:17:03 PM:  finalizing server assets 
4:17:03 PM: 03:17:03 PM [build] Rearranging server assets...
4:17:03 PM: @astrojs/sitemap: `sitemap-index.xml` is created.
4:17:03 PM: 03:17:03 PM [build] Server built in 3.07s
4:17:03 PM: 03:17:03 PM [build] Complete!
4:17:03 PM: ​
4:17:03 PM: (build.command completed in 4.4s)
4:17:03 PM: ​
4:17:03 PM: ────────────────────────────────────────────────────────────────
4:17:03 PM:   2. Functions bundling                                         
4:17:03 PM: ────────────────────────────────────────────────────────────────
4:17:03 PM: ​
4:17:03 PM: Packaging Functions from .netlify/functions-internal directory:
4:17:03 PM:  - entry.mjs
4:17:03 PM: ​
4:17:03 PM: ✘ [ERROR] Could not resolve "canvas"
4:17:03 PM:     node_modules/jsdom/lib/jsdom/utils.js:158:25:
4:17:03 PM:       158 │   const Canvas = require("canvas");
4:17:03 PM:           ╵                          ~~~~~~~~
4:17:03 PM:   You can mark the path "canvas" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.
4:17:03 PM: ▲ [WARNING] "./xhr-sync-worker.js" should be marked as external for use with "require.resolve"
4:17:03 PM:     node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:31:57:
4:17:03 PM:       31 │ ... require.resolve ? require.resolve("./xhr-sync-worker.js") : null;
4:17:03 PM:          ╵                                       ~~~~~~~~~~~~~~~~~~~~~~
4:17:03 PM: ​
4:17:03 PM: ────────────────────────────────────────────────────────────────
4:17:03 PM:   Dependencies installation error                               
4:17:03 PM: ────────────────────────────────────────────────────────────────
4:17:03 PM: ​
4:17:03 PM:   Error message
4:17:03 PM:   A Netlify Function failed to require one of its dependencies.
4:17:03 PM:   Please make sure it is present in the site's top-level "package.json".
​
4:17:03 PM:   Build failed with 1 error:
4:17:03 PM:   node_modules/jsdom/lib/jsdom/utils.js:158:25: ERROR: Could not resolve "canvas"
4:17:03 PM: ​
4:17:03 PM:   Resolved config
4:17:03 PM:   build:
4:17:03 PM:     command: astro build
4:17:03 PM:     commandOrigin: config
4:17:03 PM:     publish: /opt/build/repo/dist
4:17:03 PM:     publishOrigin: config
4:17:03 PM:   redirects:
4:17:03 PM:     - from: /
4:17:03 PM:       status: 200
4:17:03 PM:       to: /.netlify/functions/entry
4:17:03 PM:     - from: /*
      status: 200
      to: /.netlify/functions/entry
Caching artifacts
4:17:03 PM: Started saving node modules
4:17:03 PM: Finished saving node modules
4:17:03 PM: Started saving build plugins
4:17:03 PM: Finished saving build plugins
4:17:03 PM: Started saving yarn cache
4:17:05 PM: Finished saving yarn cache
4:17:05 PM: Started saving pip cache
4:17:05 PM: Finished saving pip cache
4:17:05 PM: Started saving emacs cask dependencies
4:17:05 PM: Finished saving emacs cask dependencies
4:17:05 PM: Started saving maven dependencies
4:17:05 PM: Finished saving maven dependencies
4:17:05 PM: Started saving boot dependencies
4:17:05 PM: Finished saving boot dependencies
4:17:05 PM: Started saving rust rustup cache
4:17:05 PM: Finished saving rust rustup cache
4:17:05 PM: Started saving go dependencies
4:17:05 PM: Finished saving go dependencies
4:17:05 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:17:05 PM: Creating deploy upload records
4:17:06 PM: Failing build: Failed to build site
4:17:06 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:17:06 PM: Finished processing build request in 36.709382403s

Thanks

Hi @hickie,

That problem seems related to this: Can't resolve 'canvas' on next.js serverless app · Issue #54 · kkomelin/isomorphic-dompurify · GitHub